davethomaspilot
13th March 2017, 22:53
I want to have a QLineEntry that will acccept 8-63, printable, hex characters (wpa password).
A QRegExpValidator for this could look like this:
QRegExp rx("[ -~]{8,63}");
ui->hotSpot_PSK->setValidator(new QRegExpValidator(rx,this));
I can verify that
ui->hotSpot_PSK->hasAcceptableInput())
is true and false when expected. But, this doesn't seem to have any affect on the user can be entered. For example, the LineEntry "closes" when enter is pressed, even if less than 8 characters are entered.
Do I need to have code that tests for hasAcceptableInpu() in all the slots that would allow invalid text to be entered, including the buttons that do accept(), like OK and Apply in the typical button box?
If so, what does the validator really do for me (versus just a QRegExp test on the text()?
Thanks!
A QRegExpValidator for this could look like this:
QRegExp rx("[ -~]{8,63}");
ui->hotSpot_PSK->setValidator(new QRegExpValidator(rx,this));
I can verify that
ui->hotSpot_PSK->hasAcceptableInput())
is true and false when expected. But, this doesn't seem to have any affect on the user can be entered. For example, the LineEntry "closes" when enter is pressed, even if less than 8 characters are entered.
Do I need to have code that tests for hasAcceptableInpu() in all the slots that would allow invalid text to be entered, including the buttons that do accept(), like OK and Apply in the typical button box?
If so, what does the validator really do for me (versus just a QRegExp test on the text()?
Thanks!