MCPcopy Create free account
hub / github.com/Kitware/VTK / ProcessEvent

Method ProcessEvent

GUISupport/QtQuick/QQuickVTKInteractorAdapter.cxx:20–81  ·  view source on GitHub ↗

-------------------------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

18
19//-------------------------------------------------------------------------------------------------
20bool QQuickVTKInteractorAdapter::ProcessEvent(QEvent* e, vtkRenderWindowInteractor* iren)
21{
22 if (iren == nullptr || e == nullptr)
23 return false;
24
25 const QEvent::Type t = e->type();
26
27 if (t == QQuickVTKPinchEvent::QQuickVTKPinch)
28 {
29 QQuickVTKPinchEvent* e2 = static_cast<QQuickVTKPinchEvent*>(e);
30 if (e2->pinchEventType() != QQuickVTKPinchEvent::QQUICKVTK_NONE)
31 {
32 iren->SetEventInformationFlipY(e2->position().x() * this->DevicePixelRatio +
33 QVTKInteractorAdapter::DevicePixelRatioTolerance,
34 e2->position().y() * this->DevicePixelRatio +
35 QVTKInteractorAdapter::DevicePixelRatioTolerance);
36 }
37 switch (e2->pinchEventType())
38 {
39 case QQuickVTKPinchEvent::QQUICKVTK_TRANSLATE:
40 {
41 double trans[2] = { e2->translation().x() * this->DevicePixelRatio +
42 QVTKInteractorAdapter::DevicePixelRatioTolerance,
43 -1.0 * e2->translation().y() * this->DevicePixelRatio +
44 QVTKInteractorAdapter::DevicePixelRatioTolerance };
45 iren->SetTranslation(trans);
46 iren->InvokeEvent(vtkCommand::StartPanEvent, nullptr);
47 iren->InvokeEvent(vtkCommand::PanEvent, nullptr);
48 iren->InvokeEvent(vtkCommand::EndPanEvent, nullptr);
49 break;
50 }
51 case QQuickVTKPinchEvent::QQUICKVTK_SCALE:
52 {
53 iren->SetScale(1.0);
54 iren->SetScale(e2->scale());
55 iren->InvokeEvent(vtkCommand::StartPinchEvent, nullptr);
56 iren->InvokeEvent(vtkCommand::PinchEvent, nullptr);
57 iren->InvokeEvent(vtkCommand::EndPinchEvent, nullptr);
58 break;
59 }
60 case QQuickVTKPinchEvent::QQUICKVTK_ROTATE:
61 {
62 iren->SetRotation(0.0);
63 iren->SetRotation(-1.0 * e2->angle());
64 iren->InvokeEvent(vtkCommand::StartRotateEvent, nullptr);
65 iren->InvokeEvent(vtkCommand::RotateEvent, nullptr);
66 iren->InvokeEvent(vtkCommand::EndRotateEvent, nullptr);
67 break;
68 }
69 default:
70 {
71 return this->Superclass::ProcessEvent(e, iren);
72 }
73 }
74 e2->accept();
75 return true;
76 }
77 else

Callers 4

eventMethod · 0.45
pinchHandlerRotateMethod · 0.45
pinchHandlerScaleMethod · 0.45
pinchHandlerTranslateMethod · 0.45

Calls 13

pinchEventTypeMethod · 0.80
InvokeEventMethod · 0.80
scaleMethod · 0.80
SetRotationMethod · 0.80
acceptMethod · 0.80
typeMethod · 0.45
xMethod · 0.45
positionMethod · 0.45
yMethod · 0.45
translationMethod · 0.45
SetTranslationMethod · 0.45
SetScaleMethod · 0.45

Tested by

no test coverage detected