Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Always listen for Escape key?



  • Hi,

    I have a QML App with several Qt Quick Control 2 elements like buttons, textfields and so on.
    Usually always one of these elements has the focus.

    My goal is that whatever element has active focus loses it whenever escape is pressed and then an item containing several key events gets the focus. So the app could then be controlled by other keys after pressing escape.

    Can this be achieved?
    If yes, how?

    Thanks!


  • Moderators

    Use Shortcut QML element: docs. You can register it as global and control what will happen when Escape is pressed.



  • Thank you very much, it works great!


Log in to reply