ok thanks for you solution.
it is a different way than i want but with yours i can show the user if something is wrong or not.
what i want is a bit different:
i put QRegEx on all boxes so that the user is limited while typing.
at the end of my dialog there is a "Next" button. If the user presses this button the program shall check if e.g. all boxes are filled with content. if only one box is empty than the user shall be noticed about that.
I tried the button_clicked() event and added an extra function in that event. this extra function shall check if every box is not empty anymore. but how can i tell the function what dialog he shall use? i need something that i can call e.g. lineedit->text() but how can i do that?
bool fieldChecker();
void Something::on_pushButton_clicked()
{
if(fieldChecker() != true){
QMessageBox::warning(this,
"Error",
"lineedit is empty!");
}else{
QMessageBox::information(this,
"Granted",
"lineedit is not empty");
}
}
bool fieldChecker(){
if(lineedit->text() == ""){
return false;
}
return true;
}
bool fieldChecker();
void Something::on_pushButton_clicked()
{
if(fieldChecker() != true){
QMessageBox::warning(this, "Error","lineedit is empty!");
}else{
QMessageBox::information(this, "Granted", "lineedit is not empty");
}
}
bool fieldChecker(){
if(lineedit->text() == ""){
return false;
}
return true;
}
To copy to clipboard, switch view to plain text mode
The problem is: I cannot call lineedit->text() in fieldChecker(). What do i have to do to be able to use that?
Bookmarks