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

Method wheelEvent

Modules/QtWidgetsExt/src/QmitkPointListView.cpp:219–252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

217}
218
219void QmitkPointListView::wheelEvent(QWheelEvent *event)
220{
221 if (!m_PointListModel || !m_PointListModel->GetPointSet() ||
222 (int)(m_PointListModel->GetPointSet()->GetTimeSteps()) == 1)
223 return;
224
225 int whe = event->angleDelta().y();
226 mitk::PointSet::Pointer ps = dynamic_cast<mitk::PointSet *>(m_PointListModel->GetPointSet());
227 unsigned int numberOfTS = ps->GetTimeSteps();
228
229 if (numberOfTS == 1)
230 return;
231 int currentTS = this->m_PointListModel->GetTimeStep();
232 if (whe > 0)
233 {
234 if ((currentTS + 1 >= (int)numberOfTS))
235 return;
236
237 this->m_PointListModel->SetTimeStep(++currentTS);
238 }
239 else
240 {
241 if ((currentTS <= 0))
242 return;
243 this->m_PointListModel->SetTimeStep(--currentTS);
244 }
245
246 QString tooltip = QString("Use the F2/F3 keys to move a point up/down, the Del key to remove a point\nand the mouse "
247 "wheel to change the timestep.\n\nTimeStep:\t%1")
248 .arg(currentTS);
249 this->setToolTip(tooltip);
250
251 emit SignalTimeStepChanged(currentTS);
252}
253
254void QmitkPointListView::ctxMenu(const QPoint &pos)
255{

Callers

nothing calls this directly

Calls 5

GetTimeStepsMethod · 0.80
QStringClass · 0.50
GetPointSetMethod · 0.45
GetTimeStepMethod · 0.45
SetTimeStepMethod · 0.45

Tested by

no test coverage detected