Gestures: subscribe 3d view to recieve gestures

This commit is contained in:
DeepSOIC 2015-03-28 00:39:04 +03:00 committed by wmayer
parent 77ef990fa7
commit c0d15db47c
2 changed files with 15 additions and 0 deletions

View File

@ -123,7 +123,9 @@
#include <Inventor/draggers/SoCenterballDragger.h>
#include <Inventor/annex/Profiler/SoProfiler.h>
#include <qgesture.h>
#include <WinNativeGestureRecognizers.h>
//#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);

View File

@ -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);