[Interest] AA_DontUseNativeMenuBar and QCocoaMenu::insertNative()

René J.V. Bertin rjvbertin at gmail.com
Mon Dec 28 23:38:59 CET 2015


Hi,

What is the current effect of Qt::AA_DontUseNativeMenuBar in Qt 5.5, and is it to be expected that QCocoaMenu::insertNative() is called when the AA_DontUseNativeMenuBar has been set?

I'm seeing 2 undesirable effects:
1) the Mac-style toplevel menubar remains visible in addition to an in-window menubar
2) for certain menu items (created with QWidgetAction), I'm seeing errors like the ones below, generated by KF5 konsole 15.12:

void QCocoaMenu::insertNative(QCocoaMenuItem *, QCocoaMenuItem *) Menu item "Set &Encoding" is already in menu "View" , remove it from the other menu first before inserting into "Untitled"
virtual void QCocoaMenu::removeMenuItem(QPlatformMenuItem *) Item "&Switch Profile" to remove does not belong to this menu "Untitled"

(I've patched both functions to show relevant information about the menus and actions involved.)

Both actions are added to the toplevel menu and to a context menu (as well as to the in-window menubar when AA_DontUseNativeMenuBar is set). I wonder if this bit from the QWidgetAction doc explains part the issue I'm seeing:

"OS X: If you add a widget to a menu in the application's menu bar on OS X, the widget will be added and it will function but with some limitations:

The widget is reparented away from the QMenu to the native menu view. If you show the menu in some other place (e.g. as a popup menu), the widget will not be there."

Maybe I should ask this on the development ML?

Thanks for any pointers,
René




More information about the Interest mailing list