PDA

View Full Version : keyPressEvent not working in QT creator application



shivcena
9th November 2015, 12:03
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

prasad_N
9th November 2015, 16:37
void Widget::keyPressEvent(QKeyEvent *qv)
{
qDebug() << qv->key();

//try calling your base class (from which you inherit Widget) key press event if you inherit widget from QWidget
QWidget::keyPressEvent(qv);

}