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

QShortcutMap unaware of alternate keyboard layouts

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 4.0.0, 4.8.7, 5.0.0, 5.6.0, 5.7.0 Alpha, 5.7.0 Beta, 5.8.0, 5.9.0 Alpha
    • None
    • Win7 using the alternate Neo layout as input method.

    Description

      When using Qt creator with some alternate layouts, one cannot type some kind of important letters like {}<>[] etc., because Qt interprets those as the beginning of a shortcut key sequence instead of forwarding them to the text editor.

      The basic problem is that when designing the key event handling system, nobody thought about certain keyboard layouts that use alternate keys for reaching additional keyboard layers. (On QWERTY-keyboards, there is usually only one additional layer, reachable via the shift key.)

      As an example one can have a look it the German Neo Layout:
      http://neo-layout.org
      (The page is in German, but one can see an image of the key arrangement in the middle of the page. The problem lies with the keys labelled Mod3, M3, M4 and Mod4, which are used to reach the additional keyboard layers 3-6 [of which layer 3 is of singular importance, as it contains letters like {}*?()- etc.] → hovering the „Ebene X“ boxes above the image displays the different layers)

      Now what happens with these keys and why does this make QtCreator (and some other Qt-based applications) almost unusable?

      Keyboard shortcuts (like Ctrl + a) are handled by in QWindowSystemInterface::handleShortcutEvent. If a key is pressed, the QShortcutMap contained therein checks for a (partial) shortcut match, and if there is none, a so called ShortcutOverride key event is created from the key event and inserted back into the event loop. This ShortcutOverride event then triggers the letter insertion in the input field/text editor of QtCreator.

      Now if a single letter key is pressed, this causes a ShortcutOverride event immediately, as for a shortcut, there are at least 2 keys required (I am simplifying a bit here ).

      If Shift + a letter key is pressed, the map ignores the Shift key and behaves like in the previous case, as shift keys are „expected“ modifiers. See QShortcutMap line 370:
      http://code.qt.io/cgit/qt/qtbase.git/tree/src/gui/kernel/qshortcutmap.cpp?h=5.7

      Now if an „unconventional“ modifier is pressed, like the Tab key, which serves as „Mod3“/„M3“ modifier for the third layer in Neo, this modifier is not filtered out/ignored. The map detects that at least 2 eligible keys are pressed and states that there is a partial hit. Therefore no ShortcutOverride event is generated as the logic dictates that if there is a hit, the shortcut handling system is responsible for handling the event and not the input area. And so, the {, [ or whatever does not appear on the screen.*

      *) Note, I am oversimplifying here again: if you hit the second key twice without letting go of CapsLock/M3, it appears on screen, because the map is reset before processing the second event.

      This makes Qt/QtCreator basically useless for programming using the Neo keyboard layout, even though that layout has been optimized for programming especially and has seen more and more users among the German programming community.

      EDIT: Other keyboard layouts that this might cause problems with (because they too are using „unconventional“ keys to reach additional layers) are probably the french BEPO and some variations of DVORAK. Haven't tested it though.

      Attachments

        Issue Links

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

          Activity

            People

              owolff Oliver Wolff
              nweyand NWeyand
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes