Results 1 to 9 of 9

Thread: key Press which key

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2006
    Posts
    849
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    6
    Thanked 163 Times in 151 Posts

    Default Re: key Press which key

    how about having a look at designer (its sources, rather)? one of the benefits of open source...

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Wiki edits
    5

    Default Re: key Press which key

    Please verify for me: Key press, insert "+", short cut??? Don't understand...

  3. #3
    Join Date
    Jan 2007
    Posts
    201
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    22

    Default Re: key Press which key

    I was not able to find it on the designer codes

  4. #4
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Wiki edits
    5

    Default Re: key Press which key

    Since neither you nor my crystal ball explains the question to my I just talk in the wind: Subclass QLineEdit use the key press event filter and check for QKeySequence or any other shortcut and emit a signal or call a function. Or use textChanged ( const QString & text ) and check if there is a + and then do what ever you want.

  5. #5
    Join Date
    Jan 2007
    Posts
    201
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    22

    Default Re: key Press which key

    Is there any example that could help me?

    I would like to chacht which key hes been presses on a qlineedit and write it to the line itself.

  6. #6
    Join Date
    Jan 2007
    Posts
    201
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    22

    Default Re: key Press which key

    any body can help me for thiss???

  7. #7
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Thanked 370 Times in 336 Posts

    Default Re: key Press which key

    install event filter on your line edit and process QKeyEvent.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  8. #8
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Wiki edits
    5

    Default Re: key Press which key

    or subclass QLineEdit and then:
    Qt Code:
    1. void YourLineEdit::keyPressEvent(QKeyEvent *e)
    2. {
    3. if (Qt::Key_Plus == e->key())
    4. qDebug("+ was pressed I ignore that")
    5. else
    6. QLineEdit::keyPressEvent(e);
    7. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. how to Simulate the keyboard press
    By duduqq in forum Qt Programming
    Replies: 3
    Last Post: 9th August 2008, 16:50
  2. Replies: 2
    Last Post: 2nd April 2008, 14:19
  3. Replies: 1
    Last Post: 24th October 2007, 18:34
  4. Replies: 7
    Last Post: 14th October 2007, 22:04
  5. QTextEdit and "Enter" press
    By krivenok in forum Qt Programming
    Replies: 2
    Last Post: 28th March 2006, 12:10

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
  •  
Qt is a trademark of The Qt Company.