Unsolved not working keyPressEvent
-
Hi.
My fullscreen widget application is working at TI EVM board with touchscreen.
I want to grab key press event from GPIO signal.keyPressEvent() is not called even when GPIO signal is activated.
But, once tapped touchscreen, keyPressEvent is called.
I don't know how to set QWidget.I tried QWidget setting as below:
- setFocus
- setFocusPolicy(Qt::StrongFocus)
Please give me some advices to solve this issue.
Thanks in advance.
-
Hi,
You should check with the board documentation what exactly happens with that touchscreen.
You can also install an event filter to see what does on before and after touching the screen. -
Hi.
Both The touch screen driver and the gpio-key driver have been able to get events.
It is confirmed by evtest.
However, it seems that the event of gpio-key is not transmitted to Qt application before Qt application get touchscreen event (mousePressEvent). -
Sounds strange... Did you try to manually send a QMouseEvent to your application before touching the screen ?
-
@SGaist said in not working keyPressEvent:
Did you try to manually send a QMouseEvent to your application before touching the screen ?
No. I don't know how to do it...
-
Hi
Something likeQWidget *w = ?? what widget you want to send it to { QMouseEvent qm2(QEvent::MouseButtonPress, pos, Qt::LeftButton , Qt::LeftButton, Qt::NoModifier); QApplication::sendEvent(w, &qm2); } { QMouseEvent qm2(QEvent::MouseButtonRelease, pos, Qt::LeftButton , Qt::LeftButton, Qt::NoModifier); QApplication::sendEvent(w, &qm2); }
-
This post is deleted!