Medical Imaging Interaction Toolkit
2018.4.99-389bf124
Medical Imaging Interaction Toolkit
|
Display the tool selection state of a mitk::ToolManager. More...
#include <QmitkToolSelectionBox.h>
Public Types | |
enum | EnabledMode { EnabledWithReferenceAndWorkingDataVisible, EnabledWithReferenceData, EnabledWithWorkingData, AlwaysEnabled } |
Public Slots | |
virtual void | setEnabled (bool) |
virtual void | SetEnabledMode (EnabledMode mode) |
virtual void | SetLayoutColumns (int) |
virtual void | SetShowNames (bool) |
virtual void | SetGenerateAccelerators (bool) |
virtual void | SetToolGUIArea (QWidget *parentWidget) |
Signals | |
void | ToolSelected (int id) |
Public Member Functions | |
QmitkToolSelectionBox (QWidget *parent=nullptr, mitk::DataStorage *storage=nullptr) | |
~QmitkToolSelectionBox () override | |
mitk::ToolManager * | GetToolManager () |
void | SetToolManager (mitk::ToolManager &) |
void | setTitle (const QString &title) |
void | SetDisplayedToolGroups (const std::string &toolGroups=nullptr) |
void | OnToolManagerToolModified () |
void | OnToolManagerReferenceDataModified () |
void | OnToolManagerWorkingDataModified () |
void | OnToolGUIProcessEventsMessage () |
void | OnToolErrorMessage (std::string s) |
void | OnGeneralToolMessage (std::string s) |
void | RecreateButtons () |
Protected Slots | |
void | toolButtonClicked (int id) |
void | SetGUIEnabledAccordingToToolManagerState () |
Protected Member Functions | |
void | showEvent (QShowEvent *) override |
void | hideEvent (QHideEvent *) override |
void | SetOrUnsetButtonForActiveTool () |
Protected Attributes | |
mitk::ToolManager::Pointer | m_ToolManager |
bool | m_SelfCall |
std::string | m_DisplayedGroups |
std::map< int, int > | m_ButtonIDForToolID |
stores relationship between button IDs of the Qt widget and tool IDs of ToolManager More... | |
std::map< int, int > | m_ToolIDForButtonID |
stores relationship between button IDs of the Qt widget and tool IDs of ToolManager More... | |
int | m_LayoutColumns |
bool | m_ShowNames |
bool | m_GenerateAccelerators |
QWidget * | m_ToolGUIWidget |
QmitkToolGUI * | m_LastToolGUI |
QButtonGroup * | m_ToolButtonGroup |
QGridLayout * | m_ButtonLayout |
EnabledMode | m_EnabledMode |
Display the tool selection state of a mitk::ToolManager.
This widget graphically displays the active tool of a mitk::ToolManager as a set of toggle buttons. Each button show the identification of a Tool (icon and name). When a button's toggle state is "down", the tool is activated. When a different button is clicked, the active tool is switched. When you click an already active button, the associated tool is deactivated with no replacement, which means that no tool is active then.
When this widget is enabled/disabled it (normally) also enables/disables the tools. There could be cases where two QmitkToolSelectionBox widgets are associated to the same ToolManager, but if this happens, please look deeply into the code.
Last contributor:
Definition at line 50 of file QmitkToolSelectionBox.h.
Enumerator | |
---|---|
EnabledWithReferenceAndWorkingDataVisible | |
EnabledWithReferenceData | |
EnabledWithWorkingData | |
AlwaysEnabled |
Definition at line 56 of file QmitkToolSelectionBox.h.
QmitkToolSelectionBox::QmitkToolSelectionBox | ( | QWidget * | parent = nullptr , |
mitk::DataStorage * | storage = nullptr |
||
) |
Definition at line 34 of file QmitkToolSelectionBox.cpp.
References mitk::ToolManagerProvider::GetInstance(), mitk::ToolManagerProvider::GetToolManager(), m_ToolButtonGroup, m_ToolManager, OnToolManagerReferenceDataModified(), OnToolManagerToolModified(), OnToolManagerWorkingDataModified(), RecreateButtons(), SetOrUnsetButtonForActiveTool(), and toolButtonClicked().
|
override |
Definition at line 85 of file QmitkToolSelectionBox.cpp.
References m_ToolManager, OnToolManagerReferenceDataModified(), OnToolManagerToolModified(), and OnToolManagerWorkingDataModified().
mitk::ToolManager * QmitkToolSelectionBox::GetToolManager | ( | ) |
Definition at line 101 of file QmitkToolSelectionBox.cpp.
References m_ToolManager.
|
overrideprotected |
Definition at line 712 of file QmitkToolSelectionBox.cpp.
References SetGUIEnabledAccordingToToolManagerState().
void QmitkToolSelectionBox::OnGeneralToolMessage | ( | std::string | s | ) |
Definition at line 647 of file QmitkToolSelectionBox.cpp.
Referenced by RecreateButtons().
void QmitkToolSelectionBox::OnToolErrorMessage | ( | std::string | s | ) |
Definition at line 641 of file QmitkToolSelectionBox.cpp.
Referenced by RecreateButtons().
void QmitkToolSelectionBox::OnToolGUIProcessEventsMessage | ( | ) |
Definition at line 636 of file QmitkToolSelectionBox.cpp.
Referenced by RecreateButtons().
void QmitkToolSelectionBox::OnToolManagerReferenceDataModified | ( | ) |
Definition at line 293 of file QmitkToolSelectionBox.cpp.
References m_SelfCall, MITK_DEBUG, and SetGUIEnabledAccordingToToolManagerState().
Referenced by QmitkToolSelectionBox(), SetToolManager(), and ~QmitkToolSelectionBox().
void QmitkToolSelectionBox::OnToolManagerToolModified | ( | ) |
Definition at line 176 of file QmitkToolSelectionBox.cpp.
References SetOrUnsetButtonForActiveTool().
Referenced by QmitkToolSelectionBox(), SetToolManager(), and ~QmitkToolSelectionBox().
void QmitkToolSelectionBox::OnToolManagerWorkingDataModified | ( | ) |
Definition at line 303 of file QmitkToolSelectionBox.cpp.
References m_SelfCall, MITK_DEBUG, and SetGUIEnabledAccordingToToolManagerState().
Referenced by QmitkToolSelectionBox(), SetToolManager(), and ~QmitkToolSelectionBox().
void QmitkToolSelectionBox::RecreateButtons | ( | ) |
Definition at line 376 of file QmitkToolSelectionBox.cpp.
References mitk::Tool::CanHandle(), mitk::Tool::ErrorMessage, mitk::Tool::GeneralMessage, mitk::DataNode::GetData(), mitk::Tool::GetGroup(), mitk::Tool::GetIconResource(), mitk::Tool::GetName(), us::ModuleResource::GetSuffix(), mitk::Tool::GetXPM(), mitk::Tool::GUIProcessEventsMessage, Json::in(), us::ModuleResource::IsValid(), m_ButtonIDForToolID, m_ButtonLayout, m_DisplayedGroups, m_GenerateAccelerators, m_LayoutColumns, m_ShowNames, m_ToolButtonGroup, m_ToolIDForButtonID, m_ToolManager, MITK_DEBUG, OnGeneralToolMessage(), OnToolErrorMessage(), OnToolGUIProcessEventsMessage(), and QmitkStyleManager::ThemeIcon().
Referenced by QmitkToolSelectionBox(), SetDisplayedToolGroups(), SetGenerateAccelerators(), SetLayoutColumns(), SetShowNames(), and SetToolManager().
void QmitkToolSelectionBox::SetDisplayedToolGroups | ( | const std::string & | toolGroups = nullptr | ) |
You may specify a list of tool "groups" that should be displayed in this widget. Every Tool can report its group as a string. This method will try to find the tool's group inside the supplied string
toolGroups. | If there is a match, the tool is displayed. Effectively, you can provide a human readable list like "default, lymphnodevolumetry, oldERISstuff". |
Definition at line 653 of file QmitkToolSelectionBox.cpp.
References m_DisplayedGroups, MITK_DEBUG, RecreateButtons(), and SetOrUnsetButtonForActiveTool().
|
virtualslot |
External enableization...
Definition at line 371 of file QmitkToolSelectionBox.cpp.
References SetGUIEnabledAccordingToToolManagerState().
|
virtualslot |
Definition at line 95 of file QmitkToolSelectionBox.cpp.
References m_EnabledMode, and SetGUIEnabledAccordingToToolManagerState().
|
virtualslot |
Definition at line 688 of file QmitkToolSelectionBox.cpp.
References m_GenerateAccelerators, and RecreateButtons().
|
protectedslot |
Implementes the logic, which decides, when tools are activated/deactivated.
Definition at line 316 of file QmitkToolSelectionBox.cpp.
References AlwaysEnabled, EnabledWithReferenceAndWorkingDataVisible, EnabledWithReferenceData, EnabledWithWorkingData, mitk::BaseRenderer::GetInstance(), mitk::BaseRenderer::GetRenderWindowByName(), mitk::DataNode::IsVisible(), m_EnabledMode, m_ToolManager, and ToolSelected().
Referenced by hideEvent(), OnToolManagerReferenceDataModified(), OnToolManagerWorkingDataModified(), setEnabled(), SetEnabledMode(), and showEvent().
|
virtualslot |
Definition at line 670 of file QmitkToolSelectionBox.cpp.
References m_LayoutColumns, and RecreateButtons().
|
protected |
Definition at line 181 of file QmitkToolSelectionBox.cpp.
References mitk::Tool::GetGroup(), mitk::Tool::GetGUI(), m_ButtonIDForToolID, m_LastToolGUI, m_ToolButtonGroup, m_ToolGUIWidget, m_ToolManager, QmitkToolGUI::SetTool(), and ToolSelected().
Referenced by OnToolManagerToolModified(), QmitkToolSelectionBox(), SetDisplayedToolGroups(), and SetToolManager().
|
virtualslot |
Definition at line 679 of file QmitkToolSelectionBox.cpp.
References m_ShowNames, and RecreateButtons().
void QmitkToolSelectionBox::setTitle | ( | const QString & | title | ) |
Definition at line 702 of file QmitkToolSelectionBox.cpp.
|
virtualslot |
Definition at line 697 of file QmitkToolSelectionBox.cpp.
References m_ToolGUIWidget.
void QmitkToolSelectionBox::SetToolManager | ( | mitk::ToolManager & | newManager | ) |
Definition at line 106 of file QmitkToolSelectionBox.cpp.
References m_ToolManager, OnToolManagerReferenceDataModified(), OnToolManagerToolModified(), OnToolManagerWorkingDataModified(), RecreateButtons(), and SetOrUnsetButtonForActiveTool().
|
overrideprotected |
Definition at line 706 of file QmitkToolSelectionBox.cpp.
References SetGUIEnabledAccordingToToolManagerState().
|
protectedslot |
Definition at line 142 of file QmitkToolSelectionBox.cpp.
References m_ButtonIDForToolID, m_SelfCall, m_ToolButtonGroup, m_ToolIDForButtonID, m_ToolManager, and MITK_DEBUG.
Referenced by QmitkToolSelectionBox().
|
signal |
Whenever a tool is activated. id is the index of the active tool. Counting starts at 0, -1 indicates "no tool selected" This signal is also emitted, when the whole QmitkToolSelectionBox get disabled. Then it will claim ToolSelected(-1) When it is enabled again, there will be another ToolSelected event with the tool that is currently selected
Referenced by SetGUIEnabledAccordingToToolManagerState(), and SetOrUnsetButtonForActiveTool().
|
protected |
stores relationship between button IDs of the Qt widget and tool IDs of ToolManager
Definition at line 129 of file QmitkToolSelectionBox.h.
Referenced by RecreateButtons(), SetOrUnsetButtonForActiveTool(), and toolButtonClicked().
|
protected |
Definition at line 142 of file QmitkToolSelectionBox.h.
Referenced by RecreateButtons().
|
protected |
Definition at line 126 of file QmitkToolSelectionBox.h.
Referenced by RecreateButtons(), and SetDisplayedToolGroups().
|
protected |
Definition at line 144 of file QmitkToolSelectionBox.h.
Referenced by SetEnabledMode(), and SetGUIEnabledAccordingToToolManagerState().
|
protected |
Definition at line 135 of file QmitkToolSelectionBox.h.
Referenced by RecreateButtons(), and SetGenerateAccelerators().
|
protected |
Definition at line 138 of file QmitkToolSelectionBox.h.
Referenced by SetOrUnsetButtonForActiveTool().
|
protected |
Definition at line 133 of file QmitkToolSelectionBox.h.
Referenced by RecreateButtons(), and SetLayoutColumns().
|
protected |
Definition at line 124 of file QmitkToolSelectionBox.h.
Referenced by OnToolManagerReferenceDataModified(), OnToolManagerWorkingDataModified(), and toolButtonClicked().
|
protected |
Definition at line 134 of file QmitkToolSelectionBox.h.
Referenced by RecreateButtons(), and SetShowNames().
|
protected |
Definition at line 141 of file QmitkToolSelectionBox.h.
Referenced by QmitkToolSelectionBox(), RecreateButtons(), SetOrUnsetButtonForActiveTool(), and toolButtonClicked().
|
protected |
Definition at line 137 of file QmitkToolSelectionBox.h.
Referenced by SetOrUnsetButtonForActiveTool(), and SetToolGUIArea().
|
protected |
stores relationship between button IDs of the Qt widget and tool IDs of ToolManager
Definition at line 131 of file QmitkToolSelectionBox.h.
Referenced by RecreateButtons(), and toolButtonClicked().
|
protected |
Definition at line 122 of file QmitkToolSelectionBox.h.
Referenced by GetToolManager(), QmitkToolSelectionBox(), RecreateButtons(), SetGUIEnabledAccordingToToolManagerState(), SetOrUnsetButtonForActiveTool(), SetToolManager(), toolButtonClicked(), and ~QmitkToolSelectionBox().