Results 1 to 2 of 2

Thread: KeyPressEvent Playing up

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2011
    Posts
    203
    Thanks
    7
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default KeyPressEvent Playing up

    Hi Guys,

    Trying to get my keypressevent working, but it's being stubborn:

    Qt Code:
    1. void GLWidget::keyPressEvent(QKeyEvent *cKeyEventPtr)
    2. {
    3. qDebug() << m_bShow;
    4. qDebug() << cKeyEventPtr;
    5. if(cKeyEventPtr->key() == Qt::Key_F1 && m_bShow == ON)
    6. {
    7. qDebug() << m_bShow;
    8. this->hide();
    9. }
    10. else if(cKeyEventPtr->key() == Qt::Key_F1 && m_bShow == OFF)
    11. {
    12. qDebug() << m_bShow;
    13. this->show();
    14. }
    15. }
    To copy to clipboard, switch view to plain text mode 

    It's not showing any lines of code when I start bashing all my keys on my keyboard, so not sure why this is the case. My mouse click events are working fine .

    I've got:

    #include <QKeyEvent>

  2. #2
    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: KeyPressEvent Playing up

    "Behind every great fortune lies a crime" - Balzac

Similar Threads

  1. Problem with KeyPressEvent
    By sali555 in forum Qt Programming
    Replies: 2
    Last Post: 24th April 2011, 15:08
  2. top level keyPressEvent
    By mhoover in forum Qt Programming
    Replies: 1
    Last Post: 14th September 2010, 21:42
  3. keypressevent
    By djwk in forum Newbie
    Replies: 9
    Last Post: 5th July 2010, 02:12
  4. Replace keyPressEvent (dot with tab)
    By the_bis in forum Qt Programming
    Replies: 1
    Last Post: 6th June 2008, 10:43
  5. Getting real key in keyPressEvent
    By EricF in forum Qt Programming
    Replies: 2
    Last Post: 20th March 2008, 14:39

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.