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

Method mousePressEvent

Modules/QtWidgetsExt/src/QmitkTransferFunctionCanvas.cpp:74–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72}
73
74void 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
102void QmitkTransferFunctionCanvas::mouseMoveEvent(QMouseEvent *mouseEvent)
103{

Callers

nothing calls this directly

Calls 3

CanvasToFunctionMethod · 0.95
clearMethod · 0.45
RequestUpdateAllMethod · 0.45

Tested by

no test coverage detected