Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Game Development
  4. Keyboard Key without modifier
Qt 6.11 is out! See what's new in the release blog

Keyboard Key without modifier

Scheduled Pinned Locked Moved Unsolved Game Development
2 Posts 2 Posters 1.5k 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.
  • T Offline
    T Offline
    twisted
    wrote on last edited by
    #1

    Hi,

    I'm looking for a portable and reliable way to get key input ignoring any modifiers, for example on a UK keyboard '!' is assigned to the '1' key when shift is down.

    What I need is to be able to convert '!' when the shift key is down to whatever the key should be without it. I could simply hard code '!' = '1' but obviously this won't work for foreign keyboards which have different placements.

    I found the function nativeScanCode in QKeyEvent but it clearly states that this will always return 0 on Mac OS/X making this useless.

    Appreciate any help with this!

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

      Hi! You could install a key event filter on your object (or maybe on the QApplication object). In that event filter you'd catch all key press events that have a modifier, remove the modifier from such an event and then proceed the event handling with the altered event.

      As a starting point, have a look at this post.

      1 Reply Last reply
      1

      • Login

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