Medical Imaging Interaction Toolkit  2021.10.99-1c4db16f
Medical Imaging Interaction Toolkit
QmitkToolSelectionBox.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef QmitkToolSelectionBox_h_Included
14 #define QmitkToolSelectionBox_h_Included
15 
16 #include "QmitkToolGUIArea.h"
18 
19 #include "mitkToolManager.h"
20 
21 #include <QButtonGroup>
22 #include <QGridLayout>
23 #include <QWidget>
24 
25 #include <map>
26 
27 class QmitkToolGUI;
28 
52 {
53  Q_OBJECT
54 
55 public:
57  {
61  AlwaysEnabled
62  };
63 
64  QmitkToolSelectionBox(QWidget *parent = nullptr, mitk::DataStorage *storage = nullptr);
65  ~QmitkToolSelectionBox() override;
66 
67  mitk::ToolManager *GetToolManager();
68  void SetToolManager(mitk::ToolManager &); // no nullptr pointer allowed here, a manager is required
69 
70  void setTitle(const QString &title);
71 
81  void SetDisplayedToolGroups(const std::string &toolGroups = nullptr);
82 
83  void OnToolManagerToolModified();
84  void OnToolManagerReferenceDataModified();
85  void OnToolManagerWorkingDataModified();
86 
87  void OnToolGUIProcessEventsMessage();
88  void OnToolErrorMessage(std::string s);
89  void OnGeneralToolMessage(std::string s);
90 
91  void RecreateButtons();
92 
93 signals:
94 
100  void ToolSelected(int id);
101 
102 public slots:
103 
104  virtual void setEnabled(bool);
105  virtual void SetEnabledMode(EnabledMode mode);
106 
107  virtual void SetLayoutColumns(int);
108  virtual void SetShowNames(bool);
109  virtual void SetGenerateAccelerators(bool);
110 
111  virtual void SetToolGUIArea(QWidget *parentWidget);
112 
113 protected slots:
114 
115  void toolButtonClicked(int id);
116  void SetGUIEnabledAccordingToToolManagerState();
117  void UpdateButtonsEnabledState();
118 
119 protected:
120  void showEvent(QShowEvent *) override;
121  void hideEvent(QHideEvent *) override;
122 
123  void SetOrUnsetButtonForActiveTool();
124 
125  mitk::ToolManager::Pointer m_ToolManager;
126 
128 
129  std::string m_DisplayedGroups;
130 
132  std::map<int, int> m_ButtonIDForToolID;
134  std::map<int, int> m_ToolIDForButtonID;
135 
139 
140  QWidget *m_ToolGUIWidget;
142 
143  // store buttons in this group
144  QButtonGroup *m_ToolButtonGroup;
145  QGridLayout *m_ButtonLayout;
146 
148 };
149 
150 #endif
std::map< int, int > m_ToolIDForButtonID
stores relationship between button IDs of the Qt widget and tool IDs of ToolManager ...
Data management class that handles &#39;was created by&#39; relations.
Display the tool selection state of a mitk::ToolManager.
mitk::ToolManager::Pointer m_ToolManager
Base class for GUIs belonging to mitk::Tool classes.
Definition: QmitkToolGUI.h:32
#define MITKSEGMENTATIONUI_EXPORT
std::map< int, int > m_ButtonIDForToolID
stores relationship between button IDs of the Qt widget and tool IDs of ToolManager ...
Manages and coordinates instances of mitk::Tool.