| 72 | } |
| 73 | |
| 74 | void QmitkTransferFunctionCanvas::mousePressEvent(QMouseEvent *mouseEvent) |
| 75 | { |
| 76 | if (m_LineEditAvailable) |
| 77 | { |
| 78 | m_XEdit->clear(); |
| 79 | if (m_YEdit) |
| 80 | m_YEdit->clear(); |
| 81 | } |
| 82 | |
| 83 | const auto pos = mouseEvent->position().toPoint(); |
| 84 | m_GrabbedHandle = GetNearHandle(pos.x(), pos.y()); |
| 85 | |
| 86 | if ((mouseEvent->button() & Qt::LeftButton) && m_GrabbedHandle == -1) |
| 87 | { |
| 88 | auto [x, value] = this->CanvasToFunction(std::make_pair(pos.x(), pos.y())); |
| 89 | this->AddFunctionPoint(x, value); |
| 90 | m_GrabbedHandle = GetNearHandle(pos.x(), pos.y()); |
| 91 | mitk::RenderingManager::GetInstance()->RequestUpdateAll(); |
| 92 | } |
| 93 | else if ((mouseEvent->button() & Qt::RightButton) && m_GrabbedHandle != -1 && this->GetFunctionSize() > 1) |
| 94 | { |
| 95 | this->RemoveFunctionPoint(this->GetFunctionX(m_GrabbedHandle)); |
| 96 | m_GrabbedHandle = -1; |
| 97 | mitk::RenderingManager::GetInstance()->RequestUpdateAll(); |
| 98 | } |
| 99 | update(); |
| 100 | } |
| 101 | |
| 102 | void QmitkTransferFunctionCanvas::mouseMoveEvent(QMouseEvent *mouseEvent) |
| 103 | { |
nothing calls this directly
no test coverage detected