22 #include <QMouseEvent>
27 :
QgsMapTool( canvas ), mDragging( false ), mPinching( false )
37 mCanvas->ungrabGesture( Qt::PinchGesture );
42 mCanvas->grabGesture( Qt::PinchGesture );
48 mCanvas->ungrabGesture( Qt::PinchGesture );
56 if (( e->buttons() & Qt::LeftButton ) )
69 if ( e->button() == Qt::LeftButton )
97 qDebug() <<
"gesture " << event;
98 if ( QGesture *gesture = event->gesture( Qt::PinchGesture ) )
101 pinchTriggered( static_cast<QPinchGesture *>( gesture ) );
107 void QgsMapToolTouch::pinchTriggered( QPinchGesture *gesture )
109 if ( gesture->state() == Qt::GestureFinished )
112 if ( 0.98 < gesture->totalScaleFactor() && gesture->totalScaleFactor() < 1.02 )
119 QPoint pos = gesture->centerPoint().toPoint();
120 pos =
mCanvas->mapFromGlobal( pos );
124 r.
scale( 1 / gesture->totalScaleFactor(), ¢er );