Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Solved Catch android menu key in qml?

    Mobile and Embedded
    2
    2
    456
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      Mr Pang last edited by

      Keys.onPressed {
      console.warn(event.key);
      }

      print nothing when I click menu key.

      D 1 Reply Last reply Reply Quote 0
      • D
        Devopia53 @Mr Pang last edited by

        @Mr-Pang

        Your QML item should always have a focus otherwise you will get no key events.

        For example, in QML you would do something like this:

        Rectangle {
        focus: true
        anchors.fill: parent
        [...]
        Keys.onPressed: {
        console.log("Keys.onPressed!")
        event.accepted = true
        }
        }

        1 Reply Last reply Reply Quote 0
        • First post
          Last post