MCPcopy Create free account
hub / github.com/MITK/MITK / toolButtonClicked

Method toolButtonClicked

Modules/SegmentationUI/src/QmitkToolSelectionBox.cpp:135–179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133}
134
135void QmitkToolSelectionBox::toolButtonClicked(int id)
136{
137 if (!QWidget::isEnabled())
138 return; // this method could be triggered from the constructor, when we are still disabled
139
140 MITK_DEBUG << "toolButtonClicked(" << id << "): id translates to tool ID " << m_ToolIDForButtonID[id];
141
142 QToolButton *toolButton = dynamic_cast<QToolButton *>(m_ToolButtonGroup->buttons().at(id));
143 mitk::Tool *tool = m_ToolManager->GetActiveTool();
144 if (tool && tool->ConfirmBeforeDeactivation() &&
145 QMessageBox::No == QMessageBox::question(nullptr,
146 tool->GetName(),
147 QStringLiteral("The %1 tool currently has unconfirmed results. "
148 "Do you really want to discard the results by "
149 "exiting the tool now?").arg(tool->GetName()),
150 QMessageBox::Yes | QMessageBox::No,
151 QMessageBox::No))
152 {
153 toolButton->setChecked(false);
154 return;
155 }
156
157 if (toolButton)
158 {
159 if ((m_ButtonIDForToolID.find(m_ToolManager->GetActiveToolID()) !=
160 m_ButtonIDForToolID.end()) // if we have this tool in our box
161 &&
162 (m_ButtonIDForToolID[m_ToolManager->GetActiveToolID()] ==
163 id)) // the tool corresponding to this button is already active
164 {
165 // disable this button, disable all tools
166 toolButton->setChecked(false);
167 m_ToolManager->ActivateTool(-1); // disable everything
168 }
169 else
170 {
171 // enable the corresponding tool
172 m_SelfCall = true;
173
174 m_ToolManager->ActivateTool(m_ToolIDForButtonID[id]);
175
176 m_SelfCall = false;
177 }
178 }
179}
180
181void QmitkToolSelectionBox::OnToolManagerToolModified()
182{

Callers

nothing calls this directly

Calls 8

atMethod · 0.80
GetActiveToolMethod · 0.80
GetActiveToolIDMethod · 0.80
ActivateToolMethod · 0.80
GetNameMethod · 0.45
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected