Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. In QML is there a way to set the key repeat to false or implement the Ctrl key without causing the key released event?
Qt 6.11 is out! See what's new in the release blog

In QML is there a way to set the key repeat to false or implement the Ctrl key without causing the key released event?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
8 Posts 3 Posters 951 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.
  • A Offline
    A Offline
    AI_Messiah
    wrote on last edited by
    #1

    What I would like to do is move a character at 2 different speeds with the arrow keys. It would be nice to just speed up when the arrow key is pressed twice. Is there a way to work around this?

    1 Reply Last reply
    0
    • fcarneyF Offline
      fcarneyF Offline
      fcarney
      wrote on last edited by
      #2

      There is pressed and released signals. You have to check which key is pressed and released. This will keep the events separate. I am not sure about how to handle repeat.

      C++ is a perfectly valid school of magic.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        AI_Messiah
        wrote on last edited by
        #3

        The thing is that I understand this and I am using it, but I could use a better solution for 2 speeds.

        1 Reply Last reply
        0
        • fcarneyF Offline
          fcarneyF Offline
          fcarney
          wrote on last edited by
          #4

          @AI_Messiah said in In QML is there a way to set the key repeat to false or implement the Ctrl key without causing the key released event?:

          move a character

          I don't know what this means. Are you using a text input Item or something similar? Please post what objects you are using. Some qml code showing what you are doing will help.

          C++ is a perfectly valid school of magic.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            AI_Messiah
            wrote on last edited by
            #5

            It's for controlling the movement of the main character in a game. I know that I can make it start moving with a key-pressed signal and if it is already moving not to effect it. Then when the key is released request a stop. This is not an actual stop. It stops when the character is at the first frame. The thing is when I tried to say that when the key is released that I should check for another key-pressed within a short amount of time another cycle of events is implemented: meaning it acts like the key has been pressed twice when really it is just once because of the key repeat. Is there a way to turn it off? Or is there a way to handle 2 keys simultaneously like the arrow and control keys?

            1 Reply Last reply
            0
            • 6thC6 Offline
              6thC6 Offline
              6thC
              wrote on last edited by
              #6

              Have you seen: Qt Quick 3D > QML Types > WasdController#shiftSpeed-prop

              If that control is not useful on it's own, it's what I use for camera controls, then perhaps you could see how they do it. I expect something like KeyEvent#modifiers-prop

              1 Reply Last reply
              1
              • A Offline
                A Offline
                AI_Messiah
                wrote on last edited by
                #7

                I will try the event.modifiers thank you.

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  AI_Messiah
                  wrote on last edited by
                  #8

                  the event modifiers works but the WasdControler does not work.

                  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 Extensions
                  • Unsolved