PDA

View Full Version : verification QlineEdit



vinny gracindo
2nd November 2009, 17:24
How do I make a check in a form that is not clicked the OK button if there is any field empty (null or blank)?

squidge
2nd November 2009, 19:25
Disable the button by default and only enable it when you know all the fields are filled in to your satisfaction? Maybe you could use the focusOut to detect when a field has been completed and then check the contents before enabling the button. If you want it to enable as the user is typing you could install a simple keyPress event filter that does the checking per keypress.

franz
2nd November 2009, 20:17
Look into QValidator and QLineEdit::setValidator() (http://doc.trolltech.com/latest/qlineedit.html#setValidator).

wysota
2nd November 2009, 22:21
I'd suggest doing it in a similar fashion QWizardPage does it - using signals and slots.