Solved Problem with QMenu and Mac
-
Hi, these lines of code
QMenu *Menu= new QMenu(this); QAction *QAction01= new QAction("01", this); QAction *QAction02= new QAction("02", this); QAction *QAction03= new QAction("03", this); Menu->addAction(QAction01); Menu->addAction(QAction02); Menu->addAction(QAction03); ui->actionMenu_02->setMenu(Menu);
add actions ("Action 01", "Action 02", "Action 03") in an action called "Menu 02" of the main menu bar.
The lines of code work perfectly on Linux and Windows but not on Mac.
After having added the new actions, the original "Menu 02" action will disabled and I don't find a way to renenable it.
On Mac I'm using Qt 5.9. Is this a bug?
Is there a way to resolve? -
Hi,
Can you provide a complete minimal code sample that shows that behaviour ?
-
Please create a new QWidget project.
After that please create a "File" menu and a sub item called "actionMenu_02" (such as "Open file").
After that please add the lines of code above in the constructor. -
Can't reproduce it here with the instructions you provided.
-
Qt 5.9.2
Mac OSX 10.13.6 High Sierra -
I didn't say I didn't believe you, just that I wasn't able to reproduce that with the information at hand.
Can you test your application with a more recent version of Qt ? 5.9.2 is outdated.
-
Solved with the last Qt version.