Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

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?


  • Lifetime Qt Champion

    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.


  • Lifetime Qt Champion

    Can't reproduce it here with the instructions you provided.



  • Screenshot_20191017_090303.png
    Screenshot_20191017_090335.png
    Screenshot_20191017_090409.png

    Qt 5.9.2
    Mac OSX 10.13.6 High Sierra


  • Lifetime Qt Champion

    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.


Log in to reply