@* The Help Menu. \noindent Every window has a help menu that is inserted at the end of any configuration defined menus. At present this only serves to have a place to hold the "About Typica" menu item which brings up an appropriate about box, but there is the possibility that future developments will introduce other items that should be included in this menu. @= HelpMenu *helpMenu = new HelpMenu(); window->menuBar()->addMenu(helpMenu); @ Since the help menu is represented by its own class, we must have a declaration for that class. This is a trivial case. @(helpmenu.h@>= #include #ifndef HelpMenuHeader #define HelpMenuHeader class HelpMenu : public QMenu { Q_OBJECT public: HelpMenu(); public slots: void displayAboutTypica(); }; #endif @ Implementation is in a separate file. @(helpmenu.cpp@>= #include "helpmenu.h" #include "abouttypica.h" @@; @ The constructor sets an object name for the menu so scripts are able to look up the menu and add additional items. The "About Typica" menu item also has an object name which can be used to provide custom handling if this is desired. The |triggered()| signal from that item is immediately connected to a handler for displaying an about box. @= HelpMenu::HelpMenu() : QMenu() { setObjectName("helpMenu"); setTitle(tr("Help")); QAction *aboutTypicaAction = new QAction(tr("About Typica"), this); aboutTypicaAction->setObjectName("aboutTypicaAction"); addAction(aboutTypicaAction); connect(aboutTypicaAction, SIGNAL(triggered()), this, SLOT(displayAboutTypica())); } @ When "About Typica" is selected from the menu, we display an about box. This is also handled by a separate class. @= void HelpMenu::displayAboutTypica() { AboutTypica *aboutBox = new AboutTypica; aboutBox->show(); }