Results 1 to 2 of 2

Thread: KeyPressEvent and QLineEdit question

  1. #1
    Join Date
    Jan 2006
    Location
    Riverside, Rhode Island, USA
    Posts
    245
    Thanks
    52
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default KeyPressEvent and QLineEdit question

    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

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: KeyPressEvent and QLineEdit question

    If you're 100% sure this must happen before the key press event reaches line edit, reimplement QWidget::keyPressEvent() (or install an event filter). However, if you're happy with getting informed immediately afterwards, you could simply connect to QLineEdit::textChanged() or QLineEdit::textEdited().
    J-P Nurmi

  3. The following user says thank you to jpn for this useful post:

    impeteperry (26th August 2007)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.