| 184 | } |
| 185 | |
| 186 | void 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 |
| 231 | void QmitkTransferFunctionCanvas::SetImmediateUpdate(bool state) |
nothing calls this directly
no test coverage detected