NorMIT-nav  16.5
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cxDynamicMainWindowWidgets.h
Go to the documentation of this file.
1 #ifndef CXDYNAMICMAINWINDOWWIDGETS_H_
2 #define CXDYNAMICMAINWINDOWWIDGETS_H_
3 
4 #include <set>
5 #include <QString>
6 #include <QObject>
7 class QMainWindow;
8 class QDockWidget;
9 class QScrollArea;
10 class QWidget;
11 class QAction;
12 class QToolBar;
13 class QMenu;
14 class QActionGroup;
15 #include "cxStateService.h"
16 
17 namespace cx
18 {
19 class Desktop;
20 
30 class DynamicMainWindowWidgets : public QObject
31 {
32  Q_OBJECT
33 
34 public:
35  DynamicMainWindowWidgets(QMainWindow* mainWindow);
36  QDockWidget* addAsDockWidget(QWidget* widget, QString groupname, QObject* owningPlugin=NULL);
37  void registerToolBar(QToolBar* toolbar, QString groupname = "Toolbars");
38  void owningServiceRemoved(QObject* service);
39  void hideAll();
40  void restoreFrom(const Desktop& desktop);
41  QMenu* createPopupMenu();
42  void showWidget(QString name);
43 
44 private slots:
45  void onConsoleWindowTitleChanged(const QString & title);
46  void onWidgetActionTriggered(bool checked);
47 
48 private:
54  struct DynamicWidget
55  {
56  QWidget* mWidget;
57  QString mGroup;
58  QString mName;
59  QObject* mOwningService;
60  };
61  void restorePreset(const Desktop::Preset& preset);
62 
63  QDockWidget* createDockWidget(QWidget* widget);
64  QScrollArea *addVerticalScroller(QWidget* widget);
65  void tabifyWidget(QDockWidget* dockWidget);
66  typedef std::map<QString, QActionGroup*> ActionGroupMap;
67  void addToWidgetGroupMap(ActionGroupMap& groups, QAction* action, QString groupname);
68  QDockWidget* getFirstDockWidget(Qt::DockWidgetArea area);
69 
70  QMainWindow* mMainWindow;
71  std::vector<DynamicWidget> mItems;
72  QToolBar* mFirstDummyToolbar;
73 };
74 
75 } // namespace cx
76 
77 #endif // CXDYNAMICMAINWINDOWWIDGETS_H_
void registerToolBar(QToolBar *toolbar, QString groupname="Toolbars")
DynamicMainWindowWidgets(QMainWindow *mainWindow)
void restoreFrom(const Desktop &desktop)
Data class for CustusX desktop.
QDockWidget * addAsDockWidget(QWidget *widget, QString groupname, QObject *owningPlugin=NULL)