Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-117781

Key event for modifier keys have modifier state included

    XMLWordPrintable

Details

    Description

      A key press event for the Control key surprisingly has Control modifier set as well, resulting in e.g. key sequences such as Ctrl+Control.

      This should only be the case if pressing an additional control key, while holding an existing control key.

      The same applies for the other modifiers.

      The windows key mapper seems to have some logic for this, but it's actually setting the modifier state instead, since it's XOR'ing the state:

      // Invert state logic:
          // If the key actually pressed is a modifier key, then we remove its modifier key from the
          // state, since a modifier-key can't have itself as a modifier
          if (code == Qt::Key_Control)
              state = state ^ Qt::ControlModifier;
          else if (code == Qt::Key_Shift)
              state = state ^ Qt::ShiftModifier;
          else if (code == Qt::Key_Alt)
              state = state ^ Qt::AltModifier;
          else if (code == Qt::Key_AltGr)
              state = state ^ Qt::GroupSwitchModifier; 

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            vestbo Tor Arne Vestbø
            vestbo Tor Arne Vestbø
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes