Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.1.1, 5.2.0 Beta1
-
None
-
OS X 10.8.5
-
-
09acf326dbc6b7b67f21a360be8c91605ce47f1e
Description
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.
Attachments
Issue Links
- resulted in
-
QTBUG-53085 Reg[5.6.0-5.6.1] "Start Dictation..." and "Emoji & Symbols" are missing in Edit menu in Application
- Closed
For Gerrit Dashboard: QTBUG-34160 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
149727,5 | QCocoaMenu: Decouple NSMenuItem from NSMenu | 5.6 | qt/qtbase | Status: MERGED | +2 | 0 |
209295,4 | QMainWindow: Clear menubar parent when new one is set | 5.9 | qt/qtbase | Status: MERGED | +2 | 0 |