From 7f0ca581549e32f6c8ae1d307659c4b9da497d8d Mon Sep 17 00:00:00 2001 From: DeepSOIC Date: Sat, 28 Mar 2015 00:57:48 +0300 Subject: [PATCH] Gestures: tuning windows to enable rotates and switch off horz/vert stickiness of pans --- src/Gui/View3DInventorViewer.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/Gui/View3DInventorViewer.cpp b/src/Gui/View3DInventorViewer.cpp index 1a50745bd..6860b3f58 100644 --- a/src/Gui/View3DInventorViewer.cpp +++ b/src/Gui/View3DInventorViewer.cpp @@ -210,7 +210,29 @@ public: ViewerEventFilter() {} ~ViewerEventFilter() {} + + bool eventFilter(QObject* obj, QEvent* event) { + +#ifdef GESTURE_MESS + if (obj->isWidgetType()) { + View3DInventorViewer* v = dynamic_cast(obj); + if(v) { + if(! v->isWinGesturesTuned) { + v->isWinGesturesTuned = true; + try{ + WinNativeGestureRecognizerPinch::TuneWindowsGestures(v); + } catch (...){ + Base::Console().Warning("Failed to TuneWindowsGestures.\n"); + } + } + if (event->type() == QEvent::Show) + v->isWinGesturesTuned = false;//internally, Qt seems to set up the gestures upon showing the widget (but after this event is processed), thus invalidating our settings. Needs to be re-tuned asap. + + } + } +#endif + // Bug #0000607: Some mices also support horizontal scrolling which however might // lead to some unwanted zooming when pressing the MMB for panning. // Thus, we filter out horizontal scrolling. @@ -471,6 +493,7 @@ void View3DInventorViewer::init() recognizer->registerRecognizer(recognizer); //From now on, Qt owns the pointer. } } + this->isWinGesturesTuned = false; #endif //create the cursors