Results 1 to 2 of 2

Thread: keyPressEvent not working in QT creator application

  1. #1
    Join Date
    Oct 2015
    Posts
    27
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11

    Default keyPressEvent not working in QT creator application

    Im running a Qt application in ARM based board. Im using keyPressEvent to get the click event in the board.

    void Widget::keyPressEvent(QKeyEvent *qv)
    {
    qDebug() << qv->key();
    }

    Now the problem is if i used 2 or 3 UI controls in widget , the keypressEvent is working fine in the board. But if i add more UI controls in widget the keypressEvent is not woking. The same thing i tried for keyReleaseEvent also. But it is not working if i add more UI controls in my widget.What is the issue?


    But if i run the Qt application in my development pc. keypressEvent is working fine .Is this problem is because of ARM based board?

    And if i continuously press the button in ARM board , keypressEvent is working
    Last edited by shivcena; 9th November 2015 at 17:00.

  2. #2
    Join Date
    Jun 2015
    Location
    India
    Posts
    185
    Thanks
    8
    Thanked 14 Times in 14 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: keyPressEvent not working in QT creator application

    Qt Code:
    1. void Widget::keyPressEvent(QKeyEvent *qv)
    2. {
    3. qDebug() << qv->key();
    4.  
    5. //try calling your base class (from which you inherit Widget) key press event if you inherit widget from QWidget
    6. QWidget::keyPressEvent(qv);
    7.  
    8. }
    To copy to clipboard, switch view to plain text mode 
    Thanks :-)

Similar Threads

  1. some keys are not working(keyPressEvent)
    By sanjeet in forum Qt for Embedded and Mobile
    Replies: 2
    Last Post: 12th January 2018, 22:38
  2. keyPressEvent() not working for a tab within QTabWidget
    By sadastronaut in forum Qt Programming
    Replies: 1
    Last Post: 8th August 2014, 20:13
  3. Application freezes for 0.5 sec after keyPressEvent
    By Coolcat in forum Qt Programming
    Replies: 1
    Last Post: 21st April 2011, 13:16
  4. keyPressevent not working with timer.
    By T1001 in forum Newbie
    Replies: 5
    Last Post: 9th December 2010, 05:55
  5. vertical keypressevent not working on graphicsitem
    By creatio.x in forum Qt Programming
    Replies: 3
    Last Post: 25th December 2009, 12:23

Tags for this Thread

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.