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

Keyboard shortcuts in a Qt app do not work reliably when switching between British (or other European) and Japanese input sources while the app is running on Mac OS X

XMLWordPrintable

    • macOS

      I spotted this whilst looking into QTBUG-57934. This is reproducible with stock 5.7.1.

      STEPS TO REPRODUCE
      1. Build the attached application on the Mac.
      2. Ensure your current input source is a European one (I use British).
      3. Run the app. A keyboard shortcut is registered in the menu for ':'.
      4. Ensure the Application Output is visible in Qt Creator.
      5. Plug in a Japanese keyboard.
      6. Switch to the Japanese input source in the OS.
      7. Press ':' (which requires no shift modified on this keyboard layout).

      EXPECTED: 'QKeySequence(":")' is written to the application output, as it is if you click on the menu entry by hand.
      ACTUAL: Nothing happens.

      8. Now quit the app, but leave the input source set to Japanese.
      9. Relaunch the app.
      10. Press ':'

      EXPECTED: 'QKeySequence(":")' is written to the application output
      ACTUAL: This time it works.

      This happens because there is no code in QCocoaKeyMapper::updateKeyboard() to clear the keyboard_layout_format.unicode and keyboard_mode variables if uchrData is null, as it is for the Japanese IME. So it will use the uchr table from the previously-selected input source, in this case British, and hence none of the shortcuts will work properly.

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

            andysh Andy Shaw
            jlarcombe James Larcombe
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes