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

How to add menu items under application menu on macOS?



  • I am trying to figure out how to add QAction's to the application menu, the one automatically created with the app's name, on macOS. The application automatically adds quit and preferences actions, but I want to add another one to show my in-app purchases widget.

    Any idea how to do this?

    Thanks!
    -Patrick



  • QAction::ApplicationSpecificRole
    This action should be put in the application menu with an application specific role
    

    Create the action with this menuRole:

    action=menu->addAction(tr("Purchase..."));
    action->setMenuRole(QAction::ApplicationSpecificRole);
    


  • @mpergand said in How to add menu items under application menu on macOS?:

    QAction::ApplicationSpecificRole
    This action should be put in the application menu with an application specific role
    

    Create the action with this menuRole:

    action=menu->addAction(tr("Purchase..."));
    action->setMenuRole(QAction::ApplicationSpecificRole);
    

    Perfect! Thank you....


Log in to reply