Results 1 to 3 of 3

Thread: problem with LineEdits and keyPressEvents

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

    Default problem with LineEdits and keyPressEvents

    Hi
    I have 5 QLineEdit widgets in a row with some labels between some of them. The user may enter some text in any one of them at his option. How do I determine which widget he/she was using when the return key was pressed?

    I am running Kubuntu 7.04, qt4

    Thanks

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: problem with LineEdits and keyPressEvents

    You can either use a QSignalMapper or use the sender() object in the slot connected to returnPressed() or whatever.
    When using sender() you have to compare it with all your line edits in order to see which one sent the signal.

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

    impeteperry (5th November 2007)

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

    Default Re: problem with LineEdits and keyPressEvents

    as soon as I sent the last post, I solved my problem using "textChanged" and "textEdited"
    Thanks
    Last edited by impeteperry; 5th November 2007 at 22:58. Reason: solved problem

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.