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

Method keyPressEvent

Modules/QtWidgetsExt/src/QmitkTransferFunctionCanvas.cpp:186–228  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

184}
185
186void QmitkTransferFunctionCanvas::keyPressEvent(QKeyEvent *e)
187{
188 if (m_GrabbedHandle == -1)
189 return;
190
191 switch (e->key())
192 {
193 case Qt::Key_Delete:
194 if (this->GetFunctionSize() > 1)
195 {
196 this->RemoveFunctionPoint(GetFunctionX(m_GrabbedHandle));
197 m_GrabbedHandle = -1;
198 }
199 break;
200
201 case Qt::Key_Left:
202 this->MoveFunctionPoint(
203 m_GrabbedHandle,
204 ValidateCoord(std::make_pair(GetFunctionX(m_GrabbedHandle) - 1, GetFunctionY(m_GrabbedHandle))));
205 break;
206
207 case Qt::Key_Right:
208 this->MoveFunctionPoint(
209 m_GrabbedHandle,
210 ValidateCoord(std::make_pair(GetFunctionX(m_GrabbedHandle) + 1, GetFunctionY(m_GrabbedHandle))));
211 break;
212
213 case Qt::Key_Up:
214 this->MoveFunctionPoint(
215 m_GrabbedHandle,
216 ValidateCoord(std::make_pair(GetFunctionX(m_GrabbedHandle), GetFunctionY(m_GrabbedHandle) + 0.001)));
217 break;
218
219 case Qt::Key_Down:
220 this->MoveFunctionPoint(
221 m_GrabbedHandle,
222 ValidateCoord(std::make_pair(GetFunctionX(m_GrabbedHandle), GetFunctionY(m_GrabbedHandle) - 0.001)));
223 break;
224 }
225
226 update();
227 mitk::RenderingManager::GetInstance()->RequestUpdateAll();
228}
229
230// Update immediately while changing the transfer function
231void QmitkTransferFunctionCanvas::SetImmediateUpdate(bool state)

Callers

nothing calls this directly

Calls 5

ValidateCoordFunction · 0.85
GetFunctionXFunction · 0.50
GetFunctionYFunction · 0.50
MoveFunctionPointMethod · 0.45
RequestUpdateAllMethod · 0.45

Tested by

no test coverage detected