when i create a QAction with an attached sub menu (via setMenu()) and add this to more than one QMenu, then the App emits errors and eventually the action is not added to the subsequent menus.
The error message when adding the QAction to the 2nd menu is:
void QCocoaMenu::insertNative(QCocoaMenuItem *, QCocoaMenuItem *) Menu item is already in a menu, remove it from the other menu first before inserting
When adding the Menu to the Menubar the same error message is emitted again.
When the App is closed, this error message is emitted:
virtual void QCocoaMenu::removeMenuItem(QPlatformMenuItem *) Item to remove does not belong to this menu
the attached example can be run in two ways:
add QAction to filemenu, then to contextmenu
or vice versa, if you swap code blocks 1 and 2 in mainwindow.cpp.
if the QMenu is added to the filemenu first, then the submenu shows up in both filemenu and contextmenu.
if the submenu is added to the contextmenu first, then it does not show up in the filemenu (and in this example, the entire filemenu does not show up because it is empty)
In my actual Application error message 1 also showed up when closing the context menu for the first time but not on subsequent tries.
In the test app showing the empty context menu also yields a 3rd error message:
void QCocoaWindow::syncWindowState(Qt::WindowState) invalid window content view size, check your window geometry
this does not happen in them main menu bar.