Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Performing/ignoring modifiers in a QKeySequence?
QtWS25 Last Chance

Performing/ignoring modifiers in a QKeySequence?

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 2.5k Views
  • 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.
  • W Offline
    W Offline
    waiz
    wrote on last edited by
    #1

    Hello.

    I currently have a QPushButton which grabs the keyboard input once it's clicked, and then waits for a hotkey-combination until it releases the keyboard again.

    I'm experiencing that the QKeyEvent has a key() attribute which is modified by the shift key, so when I'm hitting Ctrl+Meta+4, it reads it as Ctrl+Meta+$. I need it to be interpreted as Ctrl+Meta+4 as I am using a QKeySequence for QxtGlobalShorcut to register a global hotkey.

    The QKeySequence is instantiated using QKeySequence(keyEvent->modifiers() + keyEvent->key()).

    So my idea for a solution might be to somehow trigger a modifier on the key sequence and modifying the contents (e.g. sending "trigger shift key" inverts the $ back to 4) or don't take literal input from X11. How could I do this? Or better yet, do you know a better solution?

    Thanks in advance.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      Are you sure that this is a good idea? Notice that not all keyboards have these symbols at the same places. So, you can't be sure that $ and 4 are only a shift key away from each other...

      1 Reply Last reply
      0
      • W Offline
        W Offline
        waiz
        wrote on last edited by
        #3

        No, I'm not sure that this approach is a good idea, though, I don't know another solution.

        The reason why I'm doing this is because when I'm registering a hotkey with QxtGlobalShorcut and the QKeySequence is "Shift+Meta+$", it doesn't react, but when it's "Shift+Meta+4", it does.

        1 Reply Last reply
        0
        • W Offline
          W Offline
          waiz
          wrote on last edited by
          #4

          Shameless bump.

          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