Details
-
Bug
-
Resolution: Fixed
-
P3: Somewhat important
-
5.15.11
-
macOS 12.5, 13, XCode 14.1
-
-
ba639edd2 (dev)
Description
On macOS, the shortcut in context menu is not shown by default.
To override this behavior,
styleHints()->setShowShortcutsInContextMenus(true)
can be set.
However, this does not have any effect in Qt5.15.
This works in older Qt versions, e.g. Qt5.14.
Sample code is below and a sample project is attached( qtbug109590-showshortcut.zip ).
In order to show the context menu, press secondary click anywhere in the window.
int main(int argc, char *argv[]) { QApplication a(argc, argv); a.styleHints()->setShowShortcutsInContextMenus( true ); QWidget w; w.setContextMenuPolicy(Qt::ActionsContextMenu); QAction act("Copy", nullptr); act.setShortcut(QKeySequence::Copy); // act.setShortcutVisibleInContextMenu(true); // Workaround w.addAction(&act); w.show(); return a.exec(); }
Attachments
Issue Links
- relates to
-
QTBUG-69452 Shortcuts don't show up in context menus
- Closed