Reputation: 717
I want to add a submenu in the application menu in Mac. The Application Menu already contains item "About myapp", "Quit myapp", etc. I want to add here a sub menu like "Themes" and then provide actions inside it like: "Theme 1", "Theme 2", etc.
So it should be like:
Menu Myapp->
Themes->
Theme 1
Theme 2
Upvotes: 1
Views: 979
Reputation: 3005
Main menu is your already existing menu. You can add a submenu with the following code
QMenu* mainMenu = new QMenu( "Menu" );
QMenu* themesMenu = new QMenu( "Themes" );
mainMenu->addMenu( themesMenu );
themesMenu->addAction( "Theme 1" );
themesMenu->addAction( "Theme 2" );
But I think you want to add some other input arguments to the addAction( ... )
function, such add the slot what shall be executed on the menu activating. Read this about this function.
Upvotes: -1