Fraxinus  2023.01.05-dev+develop.0da12
An IGT application
cxHelpWidget.h
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 #ifndef CXHELPWIDGET_H
12 #define CXHELPWIDGET_H
13 
14 #include "cxBaseWidget.h"
15 #include "boost/shared_ptr.hpp"
16 #include "org_custusx_help_Export.h"
17 class QTabWidget;
18 class QAction;
19 class QSplitter;
20 
21 namespace cx
22 {
23 typedef boost::shared_ptr<class HelpEngine> HelpEnginePtr;
24 class HelpSearchWidget;
25 class HelpIndexWidget;
26 
35 class org_custusx_help_EXPORT HelpWidget : public BaseWidget
36 {
37  Q_OBJECT
38 
39 public:
40  explicit HelpWidget(HelpEnginePtr engine, QWidget* parent = NULL);
41  virtual ~HelpWidget();
42 
43  HelpEnginePtr engine() { return mEngine; }
44  virtual QSize sizeHint() const;
45 
46 signals:
47  void requestShowLink(const QUrl&);
48 
49 private slots:
50  void toggleShowNavigationControls();
51  void backSlot();
52  void forwardSlot();
53  void onGotoDocumentation();
54 private:
59  template<class T>
60  QAction* createAction2(QObject* parent, QIcon iconName, QString text, QString tip, T slot, QLayout* layout=NULL, QToolButton* button = new QToolButton())
61  {
62  if (tip.isEmpty())
63  tip = text;
64  QAction* action = new QAction(iconName, text, parent);
65  action->setStatusTip(tip);
66  action->setWhatsThis(tip);
67  action->setToolTip(tip);
68  connect(action, &QAction::triggered, this, slot);
69  if (layout)
70  {
71  button->setDefaultAction(action);
72  layout->addWidget(button);
73  }
74  return action;
75  }
76 
77  virtual void showEvent(QShowEvent* event);
78  virtual void hideEvent(QHideEvent* event);
79  virtual void prePaintEvent();
80  void setup();
81  void addSearchWidget(QTabWidget* tabWidget, QBoxLayout* buttonLayout);
82  void addIndexWidget(QTabWidget* tabWidget, QBoxLayout* buttonLayout);
83  void addContentWidget(QTabWidget* tabWidget, QBoxLayout* buttonLayout);
84  void addToggleTabWidgetButton(QBoxLayout* buttonLayout);
85  void addWebNavigationButtons(QBoxLayout* buttonLayout);
86  void addWebButton(QBoxLayout* buttonLayout);
87 
88  QVBoxLayout* mVerticalLayout;
89  QTabWidget* mTabWidget;
90  HelpEnginePtr mEngine;
91 
92  HelpSearchWidget* mSearchWidget;
93  HelpIndexWidget* mIndexWidget;
94  class HelpBrowser *mBrowser ;
95 
96  QAction* mShowNavigationControlsAction;
97  QSplitter* mSplitter;
98 
99 };
100 
101 }//end namespace cx
102 
103 #endif // CXHELPWIDGET_H
HelpEnginePtr engine()
Definition: cxHelpWidget.h:43
Interface for QWidget which handles widgets uniformly for the system.
Definition: cxBaseWidget.h:88
boost::shared_ptr< HelpEngine > HelpEnginePtr
Definition: cxHelpEngine.h:61
Namespace for all CustusX production code.