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

[OS X]: Switching the input source from "Russian - PC" to "U.S." may prevent registered accelerators from working

XMLWordPrintable

    • macOS
    • 28c831fa13db29bd06666abefcb76f5bdf886320 0cae5a4c4b3c508463580ba740df95e92d2fc9c0

      Steps-to-reproduce:

      1) Ensure that "US" and "Russian - PC" is part of OS X's "Input Sources" by going to "System Preferences" and adding them under the "Input Sources" tab in the "Keyboard" preference. Also ensure that "Show input menu in menu bar" is enabled so you can quickly switch between the input sources.

      2) Create a basic application in Qt, registering "Shift-Ctrl-S" as an accelerator.

      3) Start the application with the "Russian - PC" input source already activated.

      4) Press the "Shift-Ctrl-S" sequence. Notice that it will not trigger.

      5) Switch the input source to "US" while the application is still running.

      6) Press the "Shift-Ctrl-S" sequence. Notice that it will still not trigger.

      7) Close the application and restart it with the "Russian - PC" input source already activated.

      8) After the application has started but before you press any keys on the keyboard, switch the input source to "US".

      9) Press the "Shift-Ctrl-S" sequence. Notice that it will now trigger as expected.

      I believe that QCocoaKeyMapper is not flushing out the key layouts that are cached whenever the input source changes, causing the issue. In particular, I believe that the commented out code calling QKeyMapper::changeKeyboard() in QCocoaKeyMapper::updateKeyMap(...) is necessary. In particular, the following lines of code:

      if (updateKeyboard())

      { // ### Qt 4 did this: // QKeyMapper::changeKeyboard(); }

      I believe this to be necessary for Qt 5 as well.

        1. qtbug50865.zip
          12 kB
        2. shortcut_test.zip
          2 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            ulherman Ulf Hermann
            daf_vandyke_com David
            Votes:
            3 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes