View Single Post
nicolai's Avatar
Posts: 1,637 | Thanked: 4,424 times | Joined on Apr 2009 @ Germany
#142
Originally Posted by D-Iivil View Post
Code:
void MainWindow::on_line_edit_font1_editingFinished()
{

if ( user inputted seven characters, which is valid ) {

// do something with the valid input

} elseif ( user inputted only four characters which is INVALID ) {

// tell user he's bad and he should write only valid things...

}

}

Code:
if (ui->line_edit_font1->text().length() == 7) {

// do something with the valid input

} elseif (ui->line_edit_font1->text().length() == 4) {

// tell user he's bad and he should write only valid things...

}
But how can the user enter invalid short text?
I don't know how this qtvalidator work, but isn't that
enough to prevent the short text?
regards
Nicolai