some keys are not working(keyPressEvent)
Hi everybody,
i am developing s/w for embedded device.
I am trying to catch all the keys and corresponding message display in my application.
i am able to get all the key event(0,1,2....., A,B,C....., and even special characters keys like right arrow, left arrow, backspace etc).
But only two keys(CANCEL, and one FUNCTION) i am not able to get. Qt not generate event for these two keys.
I have tasted it by re-implementing the keyPressEvent, but not getting event for those two keys.
But these two keys are working fine..... by h/w there is no problem. Only i am not able to get corresponding event
in my application for those keys.
I have reimplemented keyPressEvent like this and tested it.
Code:
{
qDebug("Event : key value is : %d",e->key());
}
I am able to get all the key values except those two keys
Can you tel me........Where is the problem?
thanks in advance !!!!
Re: some keys are not working(keyPressEvent)
Hi,
I got the similar issues as well. When I am in the tab (which is inside the MainWindow), I am not able to get keyPressEvent fired for the left/right arrows
Re: some keys are not working(keyPressEvent)
Quote:
I am not able to get keyPressEvent fired for the left/right arrows
That's probably because the QTabWidget (or the QTabBar inside it) is eating those events because it has input focus. Those keys are used to move from one tab to the next.
You can see those events if you install an event filter on the QTabWidget (or probably the QTabBar inside it). If it is the QTabBar that is eating the events, then you can derive your own QTabBar, override the key press event, and create your own behaviour. You can replace the QTabWidget's default tab bar by deriving your own class from QTabWidget and installing it using the QTabWidget::setTabBar() method. Even if you change nothing else, you still need to derive from QTabWidget because setTabBar() is a protected method.