Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
5.8.0, 5.9.0 RC
-
MacOS
-
-
198225983df9f402bb368b449f1abeea95ff0dce
Description
When QMenuBar::nativeMenuBar is set to false, action shortcuts don't work. The problem was introduced with https://codereview.qt-project.org/#/c/173958/. Before this patch QMenu always created a platform menu instance at construction time, but now the platform menu instance is created only when needed. Now, when native menubar is not used and the platform menu instance is not created, the shortcuts are not delivered. Thus, it seems that correct shortcut delivery needs a platform menu instance.
As a workaround one can put back the setPlatformMenu() call, which was removed from src/widgets/widgets/qmenu.cpp, QMenu::init() in the above mentioned fix patch, but note that it will bring the crash in Unity (--).QTBUG-56526
The attached example can be used to reproduce the problem. 'q' and 'e' keys are set as action shortcuts and they are connected to slots printing "Shortcut q" and "Shortcut e", which are not hit when QMenuBar::nativeMenuBar is false.
Attachments
For Gerrit Dashboard: QTBUG-61039 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
208219,5 | QShortcut: Fall back to cross platform code in absence of QPA menu | 5.9 | qt/qtbase | Status: MERGED | +2 | 0 |