Details
-
Epic
-
Resolution: Unresolved
-
P2: Important
-
None
-
Some future release
-
None
-
Native menus
-
Description
While we have QtGui platform abstractions for native menus, menu items, and menu bars, they are only used in a few places:
- QMenuBar
- Shows a native menu as a popup iff
- QMenuBar::isNativeMenuBar() is false
- Which is not normally the case on macOS
- But is the case on Window
- qt_set_sequence_auto_mnemonic() is true
- Which it is not on macOS unless called explicitly
- But is the case on Windows
- A menu item is triggered via its corresponding mnemonic, and that item is/has a menu that should open
- That menu has a platform menu
- Which it normally does not have, unless
- Someone has called toNSMenu() earlier
- Or the internal QMenu::setPlatformMenu()
- Used by QSystemTrayIconPrivate::addPlatformMenu()
- (Plumbed to QPlatformTheme::createPlatformMenu() via QPlatformSystemTrayIcon::createMenu())
- But the system tray icon's menu is not tied to QMenuBar in any way, so this is not relevant
- Used by QSystemTrayIconPrivate::addPlatformMenu()
- Which it normally does not have, unless
- QMenuBar::isNativeMenuBar() is false
- In summary
- The logic is only triggered on Windows (unless the user jumps through many hoops that's not really supported)
- But requires a platform menu, which is only likely to be the case on macOS via toNSMenu
- Ie, the QMenuBar QPlatformMenu::showPopup() logic can likely be removed
- Everything else works on a QPlatformMenuBar level already, so native menus still work
- Shows a native menu as a popup iff
- QComboBox::showPopup()
- Iff
-
-
- On an Apple OS
- If the style reports true for SH_ComboBox_UseNativePopup, which only the iOS plugin does
-
- QQuickLabsPlatformMenu
- Provides support for both menu bars and context menus