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. QKeyCombination issue
Qt 6.11 is out! See what's new in the release blog

QKeyCombination issue

Scheduled Pinned Locked Moved Unsolved General and Desktop
qkeycombinationshift
1 Posts 1 Posters 464 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.
  • Q Offline
    Q Offline
    QtUser467
    wrote on last edited by QtUser467
    #1

    I am using user-definable QKeyCombinations, which works well except for some characters.

    For example, on my keyboard, hitting "=" creates a QKeyCombination(QFlags<Qt::KeyboardModifier>(ShiftModifier), Qt::Key_Equal) because I need to press the shift key to enter an equal character (in a way it is the same as QKeyCombination(QFlags<Qt::KeyboardModifier>(ShiftModifier), Qt::Key_0), but that is not the combination that is delivered by the event).

    The problem now is that when I record the same keystroke with a QKeySequenceEdit widget, I get QKeyCombination(QFlags<Qt::KeyboardModifier>(NoModifier), Qt::Key_Equal).

    Obviously, the ShiftModifier is kind of implicit in the Qt::Key_Equal value.

    My question now is how I should compare keystrokes so that the two match, but the keyboard modifiers are respected otherwise.

    I guess I am looking at some form of "canonical key combination" that is delivered in the same form in the events and by QKeySequenceEdit...

    (I am using Qt 6.2 if that matters. I found a comment regarding these problems here [https://doc.qt.io/qt-5/qkeysequence.html#keyboard-layout-issues], but my issue is a bit different. I don't want do distinguish between Shift-0 and Shift-= or just =, but just have a way that produces that same QKeyCombination on a given machine)

    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