This application demostrates how to generate 2 sets of
menus with qmdi library. With qtmdi library, you will see that it's very simple to scale this application
into more depths of complexity.
To see the advanced menus, click the Advanced menus button on the toolbar. This will add new menus
to the menu bar, a new toolbar and it will also add new commands to the existing menus and toolbars.
This code is used to generate the normal menus:
menus["&File"]->addAction( actionFileNew ); menus["&File"]->addAction( actionFileSave ); menus["&File"]->addSeparator(); menus["&File"]->addAction( actionQuit ); menus["&Edit"]; menus["&Test"]; menus["&Settings"]->addAction( actionShowAll ); menus["&Help"]->addAction( actionAbout );
This code is used to generate the advanced menus:
advanced.menus["&File"]->addAction( actionFileSaveAs ); advanced.menus["&Test"]->addAction( test1 ); advanced.menus["&Test"]->addAction( test2 ); advanced.menus["&Help"]->addAction( actionAboutQt );
The actionShowAll
action is connected to a slot which merges, unmerges
the advaced menus from the normal ones:
void MainWindow::slot_showMenus() { bool isChecked = actionShowAll->isChecked(); if (isChecked) { menus.mergeGroupList( &advanced.menus ); toolbars.mergeGroupList( &advanced.toolbars ); } else { menus.unmergeGroupList( &advanced.menus ); toolbars.unmergeGroupList( &advanced.toolbars ); } toolBarList = toolbars.updateToolBar( toolBarList, this ); menus.updateMenu( menuBar() ); }