How to use Arrows key and Enter key for navigation/selection in a stacked widget Qt5 application?



  • Hi all,
    I have a small application that using a MainWindow and inside the main window, I have a stacked widget with push buttons,check-box and linefeed across multiple pages (stacked widget pages).
    Currently, when I clicked (mouse click) on either of widget item from Qt creator execution (on Host PC), then the desired action is performing. But I can't use mouse in my target platform.
    I want to do the navigation(UP_ARROW,LEFT_ARROW,RIGHT_ARROW,DOWN_ARROW) and selection (ENTER KEY) with the same application instead of mouse click.
    How I can tell ENTER key is for selection and Arrow keys are for navigation in Qt5?
    I came to know about "eventFilter" concept for detecting these keys. But apart from detecting these keys, how I can say one key to perform the desired action through out my application?
    For Example, When ENTER key is detected/pressed, then it should "press/click" the current/focused push button.

    Any idea or code snippet example would be appreciated.

    Thank you in advance,
    Ajith P V



Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.