Typica is a free program for professional coffee roasters. https://typica.us
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

helpmenu.w 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. @* The Help Menu.
  2. \noindent Every window has a help menu that is inserted at the end of any
  3. configuration defined menus. At present this only serves to have a place to
  4. hold the "About Typica" menu item which brings up an appropriate about box, but
  5. there is the possibility that future developments will introduce other items
  6. that should be included in this menu.
  7. @<Insert help menu@>=
  8. HelpMenu *helpMenu = new HelpMenu();
  9. window->menuBar()->addMenu(helpMenu);
  10. @ Since the help menu is represented by its own class, we must have a
  11. declaration for that class. This is a trivial case.
  12. @(helpmenu.h@>=
  13. #include <QMenu>
  14. #ifndef HelpMenuHeader
  15. #define HelpMenuHeader
  16. class HelpMenu : public QMenu
  17. {
  18. Q_OBJECT
  19. public:
  20. HelpMenu();
  21. public slots:
  22. void displayAboutTypica();
  23. void displayLicenseWindow();
  24. };
  25. #endif
  26. @ Implementation is in a separate file.
  27. @(helpmenu.cpp@>=
  28. #include "helpmenu.h"
  29. #include "abouttypica.h"
  30. #include "licensewindow.h"
  31. @<Help menu implementation@>@;
  32. @ The constructor sets an object name for the menu so scripts are able to look
  33. up the menu and add additional items.
  34. @<Help menu implementation@>=
  35. HelpMenu::HelpMenu() : QMenu()
  36. {
  37. setObjectName("helpMenu");
  38. setTitle(tr("Help"));
  39. QAction *aboutTypicaAction = new QAction(tr("About Typica"), this);
  40. aboutTypicaAction->setObjectName("aboutTypicaAction");
  41. addAction(aboutTypicaAction);
  42. connect(aboutTypicaAction, SIGNAL(triggered()), this, SLOT(displayAboutTypica()));
  43. #if 0
  44. QAction *licenseAction = new QAction(tr("License Information"), this);
  45. licenseAction->setObjectName("licenseAction");
  46. addAction(licenseAction);
  47. connect(licenseAction, SIGNAL(triggered()), this, SLOT(displayLicenseWindow()));
  48. #endif
  49. }
  50. @ When "About Typica" is selected from the menu, we display an about box. This
  51. is also handled by a separate class.
  52. @<Help menu implementation@>=
  53. void HelpMenu::displayAboutTypica()
  54. {
  55. AboutTypica *aboutBox = new AboutTypica;
  56. aboutBox->show();
  57. }
  58. @ Similarly, the "License Information" menu item brings up a window with
  59. appropriate information.
  60. @<Help menu implementation@>=
  61. void HelpMenu::displayLicenseWindow()
  62. {
  63. LicenseWindow *window = new LicenseWindow;
  64. window->show();
  65. }