From c0d15db47c4192f2901adf8d34a4c898c383896a Mon Sep 17 00:00:00 2001 From: DeepSOIC Date: Sat, 28 Mar 2015 00:39:04 +0300 Subject: [PATCH] Gestures: subscribe 3d view to recieve gestures --- src/Gui/View3DInventorViewer.cpp | 14 ++++++++++++++ src/Gui/View3DInventorViewer.h | 1 + 2 files changed, 15 insertions(+) diff --git a/src/Gui/View3DInventorViewer.cpp b/src/Gui/View3DInventorViewer.cpp index 2d6d532f1..1a50745bd 100644 --- a/src/Gui/View3DInventorViewer.cpp +++ b/src/Gui/View3DInventorViewer.cpp @@ -123,7 +123,9 @@ #include #include +#include +#include //#define FC_LOGGING_CB @@ -458,6 +460,18 @@ void View3DInventorViewer::init() viewerEventFilter = new ViewerEventFilter; installEventFilter(viewerEventFilter); getEventFilter()->registerInputDevice(new SpaceNavigatorDevice); + + this->grabGesture(Qt::PanGesture); + this->grabGesture(Qt::PinchGesture); +#ifdef GESTURE_MESS + { + static WinNativeGestureRecognizerPinch* recognizer;//static to avoid creating more than one recognizer, thus causing memory leak and gradual slowdown + if(recognizer == 0){ + recognizer = new WinNativeGestureRecognizerPinch; + recognizer->registerRecognizer(recognizer); //From now on, Qt owns the pointer. + } + } +#endif //create the cursors QBitmap cursor = QBitmap::fromData(QSize(ROTATE_WIDTH, ROTATE_HEIGHT), rotate_bitmap); diff --git a/src/Gui/View3DInventorViewer.h b/src/Gui/View3DInventorViewer.h index e844ed4e6..32037260b 100644 --- a/src/Gui/View3DInventorViewer.h +++ b/src/Gui/View3DInventorViewer.h @@ -357,6 +357,7 @@ protected: SbBool processSoEventBase(const SoEvent * const ev); void printDimension(); void selectAll(); + bool isWinGesturesTuned;//a flag. If false, gestures on windows will get tuned(or re-tuned) upon the first event that arrives to eventFilter. This is needed to tune windows gestures after Qt does it internally, since its settings are not all right for us. private: static void setViewportCB(void * userdata, SoAction * action);