PDA

View Full Version : KeyPressEvent and QLineEdit question



impeteperry
21st August 2007, 16:03
I have a clear "leUserInput" (a QLineEdit widget). When certain other conditions are met, I want to intercept a key stroke before it is displayed in the "leUserInput" to make changes to some "pushButton" options that were available before this key stroke.

Any help would be appreciated

jpn
21st August 2007, 16:18
If you're 100% sure this must happen before the key press event reaches line edit, reimplement QWidget::keyPressEvent() (or install an event filter (http://doc.trolltech.com/4.3/qobject.html#installEventFilter)). However, if you're happy with getting informed immediately afterwards, you could simply connect to QLineEdit::textChanged() or QLineEdit::textEdited().