Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Qt Keypad Navigation
AndersG last edited by
We have a custom Linux board with a touchscreen and a keypad (navigation keys) on which we are running Qt 4.7.1. I want to use the keypad for navigation in our Qt application using the Up, Down, Left and Right keys. After reading the docs I discovered that this is possible by building Qt with QT_KEYPAD_NAVIGATION defined.
I have rebuilt Qt according to this and use QApplication::setNavigationMode() in our application to set the mode to Qt::NavigationModeKeypadDirectional.
We can now navigate using the keypad but when navigating from a button to an adjacent scroll area only the scroll area gets focus and it is not possible to navigate to the widgets inside the scroll area. We have the same problem when navigation to a ListWidget, it is not possible to use the up and down key to navigate in the list. Do we need to use any other buttons to be able to “enter” a scroll area or navigate in a ListWidget?
As we have this problem and we are not totally satisfied on how the navigation behaves in our application. We are thinking of writing our own navigation functionality by installing an eventfilter and listening to the KeyPress events.
But here we get in to the next problem and that is that we don’t get any events when pressing the Left and Right keys. We set the navigation mode to Qt::NavigationModeNone now we get Key events when pressing the up and down keys. But when pressing the left end right keys we don’t get any events and the focus is moved in our application according to the tab order. It’s a similar behavior as when the mode is set to Qt::NavigationModeKeypadTabOrder but with the Left and Right keys instead.
How do I completely disable the tab functionality support so that I can receive KeyPress events from all navigation keys?
I have also recompiled Qt without QT_KEYPAD_NAVIGATION defined but then focus is moved according to tab order for all navigation keys (Up, Down, Left and Right).
BluTiGeS last edited by
did you find a solution for it I am currently struggeling with nearly the same.
We have a interactive content and scrolling is only possible if setting focus to the first element in the scrollarea (Tab scroll) or on the scrollbar which would then leave the focus of the content (only applicable for displayin content).
How have you achieved it to get it working with the keypad navigation?