Unsolved KeyPress not firing on Android tablet
-
(repost from Stackoverflow)
I am trying to adapt this solution for Android tablet
The problem is
QEvent::KeyPress
is not fired on a tablet when using a virtual keyboard.After some trial and error, I found what
QEvent::InputMethod
fired instead.Code is working on tablet with 2 modifications:
-
if ( event->type() == QEvent::KeyPress || event->type() == QEvent::InputMethod)
-
QKeyEvent* pEvent = (QKeyEvent*)( event );
I don't get why I don't have runtime exception, because InputMethod simply have no member key()
Even if it is working it is not safe.
How i should handle input in the correct way?
-