Nominate our 2022 Qt Champions!

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);

    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


    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

    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