Medical Imaging Interaction Toolkit  2026.06.00
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
14 #define QmitkToolSelectionBox_h
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 
28 class QmitkToolGUI;
29 
50 {
51  Q_OBJECT
52 
53 public:
55  QmitkToolSelectionBox(QWidget *parent = nullptr, mitk::DataStorage *storage = nullptr);
57 
62 
72  void SetDisplayedToolGroups(const std::string &toolGroups = {});
73 
80 
84  void OnToolErrorMessage(std::string s);
86  void OnGeneralToolMessage(std::string s);
87 
90 
91 signals:
92 
98  void ToolSelected(int id);
99 
100 public slots:
101 
103  virtual void setEnabled(bool);
104 
106  virtual void SetLayoutColumns(int);
108  virtual void SetShowNames(bool);
110  virtual void SetGenerateAccelerators(bool);
111 
113  virtual void SetToolGUIArea(QWidget *parentWidget);
114 
123 
124 protected slots:
125 
126  void toolButtonClicked(int id);
128 
129 protected:
130 
132 
133  mitk::ToolManager::Pointer m_ToolManager;
134 
136 
137  std::string m_DisplayedGroups;
138 
140  std::map<int, int> m_ButtonIDForToolID;
142  std::map<int, int> m_ToolIDForButtonID;
143 
147 
148  QWidget *m_ToolGUIWidget;
150  QmitkMultiLabelInspector *m_MultiLabelInspector = nullptr;
151 
152  // store buttons in this group
153  QButtonGroup *m_ToolButtonGroup;
154  QGridLayout *m_ButtonLayout;
155 };
156 
157 #endif
#define MITKSEGMENTATIONUI_EXPORT
Inspector widget providing a tree view on labels and groups of a MultiLabelSegmentation instance.
Base class for GUIs belonging to mitk::Tool classes.
Definition: QmitkToolGUI.h:32
Display the tool selection state of a mitk::ToolManager.
void OnToolGUIProcessEventsMessage()
Called to process pending GUI events from a tool. Public for itk::Command callbacks.
mitk::ToolManager::Pointer m_ToolManager
std::map< int, int > m_ButtonIDForToolID
stores relationship between button IDs of the Qt widget and tool IDs of ToolManager
~QmitkToolSelectionBox() override
void OnGeneralToolMessage(std::string s)
Called when a tool reports a general status message. Public for itk::Command callbacks.
std::map< int, int > m_ToolIDForButtonID
stores relationship between button IDs of the Qt widget and tool IDs of ToolManager
virtual void SetToolGUIArea(QWidget *parentWidget)
Sets the parent widget where tool-specific GUIs will be displayed.
void OnToolManagerReferenceDataModified()
Called when reference data is modified. Public for itk::Command callbacks.
void UpdateButtonsEnabledState()
void SetOrUnsetButtonForActiveTool()
mitk::ToolManager * GetToolManager()
Returns the associated ToolManager.
void ToolSelected(int id)
void SetDisplayedToolGroups(const std::string &toolGroups={})
Specifies which tool groups should be displayed in this widget.
void RecreateButtons()
Destroys and recreates all tool buttons based on the current ToolManager state.
QmitkToolSelectionBox(QWidget *parent=nullptr, mitk::DataStorage *storage=nullptr)
Constructs the tool selection box widget.
void SetToolManager(mitk::ToolManager &)
Sets the associated ToolManager. A valid manager is required (no nullptr).
void SetMultiLabelInspector(QmitkMultiLabelInspector *inspector)
Sets the label inspector forwarded to each created tool GUI.
virtual void setEnabled(bool)
Enables or disables the widget and all its tool buttons.
void OnToolErrorMessage(std::string s)
Called when a tool reports an error message. Public for itk::Command callbacks.
void OnToolManagerToolModified()
Called when a tool is modified. Public for itk::Command callbacks.
virtual void SetShowNames(bool)
Sets whether tool names are displayed alongside their icons.
virtual void SetLayoutColumns(int)
Sets the number of columns for the tool button grid layout.
virtual void SetGenerateAccelerators(bool)
Sets whether keyboard accelerators (shortcuts) are generated for tools.
void toolButtonClicked(int id)
void OnToolManagerWorkingDataModified()
Called when working data is modified. Public for itk::Command callbacks.
Abstract data management class that organizes DataNode objects in a directed acyclic graph.
Manages and coordinates instances of mitk::Tool.