QRegExpValidator exact number of characters
-
Hello,
I'm implementing a series of QLineEdits which I have to validate. In one case, I only want to permit exactly 8 characters no more no les. Right now I have this:@
lineEdit->setValidator(new QRegExpValidator(QRegExp("([a-zA-Z0-9]){8}"), this));
@But it also allowds expressions of less than 8. Any suggestions?
Thank you!! -
How do you intend to put the characters into the line edif when the validator would block input of less than 8 chars? I think your current solution is fine. You just need to check it later for correctnes (for example, when edit is finished, or user clicks some button).
-
You are totally right. Thank you!