Typica is a free program for professional coffee roasters. https://typica.us
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

helpmenu.w 2.3KB

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 displayFeedbackWizard();
  24. };
  25. #endif
  26. @ Implementation is in a separate file.
  27. @(helpmenu.cpp@>=
  28. #include "helpmenu.h"
  29. #include "abouttypica.h"
  30. #include "feedback.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. The "About Typica" menu item also has an
  34. object name which can be used to provide custom handling if this is desired.
  35. The |triggered()| signal from that item is immediately connected to a handler
  36. for displaying an about box.
  37. @<Help menu implementation@>=
  38. HelpMenu::HelpMenu() : QMenu()
  39. {
  40. setObjectName("helpMenu");
  41. setTitle(tr("Help"));
  42. QAction *aboutTypicaAction = new QAction(tr("About Typica"), this);
  43. aboutTypicaAction->setObjectName("aboutTypicaAction");
  44. addAction(aboutTypicaAction);
  45. connect(aboutTypicaAction, SIGNAL(triggered()), this, SLOT(displayAboutTypica()));
  46. QAction *sendFeedbackAction = new QAction(tr("Send Feedback"), this);
  47. sendFeedbackAction->setObjectName("sendFeedback");
  48. addAction(sendFeedbackAction);
  49. connect(sendFeedbackAction, SIGNAL(triggered()), this, SLOT(displayFeedbackWizard()));
  50. }
  51. @ When "About Typica" is selected from the menu, we display an about box. This
  52. is also handled by a separate class.
  53. @<Help menu implementation@>=
  54. void HelpMenu::displayAboutTypica()
  55. {
  56. AboutTypica *aboutBox = new AboutTypica;
  57. aboutBox->show();
  58. }
  59. @ A feedback wizard is also available from the Help menu.
  60. @<Help menu implementation@>=
  61. void HelpMenu::displayFeedbackWizard()
  62. {
  63. FeedbackWizard *window = new FeedbackWizard;
  64. window->show();
  65. }