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

Alt modifier doesn't work in shortcuts on MacOS

    XMLWordPrintable

    Details

    • Platform/s:
      macOS
    • Commits:
      9899c29daf3f867f02f4b5f920d50e877ec3f3c3

      Description

      When I programatically create a shortcut using setShortcut(QKeySequence("alt + X")) creates a shortcut that contains ⌥ symbol (on mac keyboards it can be found next to command key) + X, which however can't be triggered using alt + X (I have normal keyboard connected to Mac).

      In Qt4 this works fine.

      This happens with parent-less menubar only. The attached example can be used to reproduce the problem. It's menu has three items with shortcuts: cmd+T, alt+T and alt+shift+T. Shortcuts trigger statusbar message - except now only cmd+T triggers it. If you want to compare the behavior to a menubar with parent, remove the define from mainwindow.cpp, line 6. In that case all the shortcuts trigger the statusbar message.

      One workaround is to add the alt+ actions to the mainwindow too. Then the shortcut doesn't trigger the menu action though and therefore f.ex. the menu doesn't flash, but at least they work.

        Attachments

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

          Activity

            People

            • Assignee:
              andysh Andy Shaw
              Reporter:
              petrbena Petr Bena
            • Votes:
              2 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Gerrit Reviews

                There are no open Gerrit changes