[PyKDE] QValidator

Kelley Reynolds schnozzy at verbotenplanet.net
Fri May 16 22:32:00 BST 2003


I'm attempting to create a QValidator much like the built-in QIntValidator that has an optional maximum, minimum, configurable alert message, etc. Now, one of the things I'm having trouble with is controlling certain user actions in a form. The Validator works magically and perfectly if the user hits the 'enter' key, but not if they simply change focus. While this is fine for a maximum and making sure only numeral-related characters are typed in, it's not so good for the minimum. Other than using the lostFocus() signal of the QLineEdit(), (which has interesting issues when used in combination with a QMessageBox, not to mention the poor encapsulation that occurs when using lostFocus and a validator which should do all of this anyway), is there a way to make ensure validation if a user does something other than hit the 'enter' key?


Kelley Reynolds
VerbotenPlanet.net




More information about the PyQt mailing list