Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QML - detecting "key combinations"
Qt 6.12 LTS is out! See what's new in the release blog

QML - detecting "key combinations"

Scheduled Pinned Locked Moved QML and Qt Quick
5 Posts 2 Posters 3.9k Views 1 Watching
  • 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    Hello, I'm trying to detect a key combination - for example when the user presses the right arrow + enter.

    At the moment I've looked at the docs and seen how to do it with event modifiers but that doesn't offer the key combination that I'd like

    What I have at the moment:
    @
    if(event.key===Qt.Key_Return && (event.modifiers & Qt.ShiftModifier)){
    //code
    }@

    Thanks in advance for any help anyone can offer to point me in the right direction!

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      You can try moving this code to C++ and using QKeySequence class.

      (Z(:^

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        I'll look in to this, thank you! Is there no way to do it in QML/JS?

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          I don't know, probably not. The issue I had was slightly different and I remember that the QKeySequence was the only way I found.

          (Z(:^

          1 Reply Last reply
          0
          • ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #5

            Alright! Thanks a lot for your help.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt
            • Unsolved