Results 1 to 6 of 6

Thread: Catch pressed keys

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #5
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Catch pressed keys

    Quote Originally Posted by jano_alex_es View Post
    yep, thanks, but I'm looking for something not inside the Qpressevent. I'd like to know it at any time, not just when a key is pressed.
    how about my event filter code ..
    Qt Code:
    1. bool RecRepView:: eventFilter(QObject *ob, QEvent *e)
    2. {
    3. if(e->type() == QEvent::KeyPress){
    4. printf("is it coming inside event..\n");
    5. const QKeyEvent *ke = static_cast<QKeyEvent *>(e);
    6. if(ke->key()==Qt::Key_F1){
    7. qApp->quit();
    8. printf("Logout buttin clicked..\n");
    9. }
    10. return true;
    11. }
    12. return QWidget::eventFilter(ob, e);
    13. }
    To copy to clipboard, switch view to plain text mode 
    "Behind every great fortune lies a crime" - Balzac

  2. The following user says thank you to wagmare for this useful post:

    jano_alex_es (30th July 2009)

Similar Threads

  1. Can't See QToolButton pressed Signal from QTableWidget
    By mbrusati in forum Qt Programming
    Replies: 0
    Last Post: 23rd September 2008, 20:06
  2. Can't catch key_down and some keys
    By anafor2004 in forum Newbie
    Replies: 5
    Last Post: 27th February 2008, 09:00

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.