29 mMousePressStartPos =
event->pos();
31 if ( event->button() != Qt::LeftButton )
38 mLastMousePos =
event->pos();
39 view()->setCursor( Qt::ClosedHandCursor );
50 view()->horizontalScrollBar()->setValue(
view()->horizontalScrollBar()->value() - ( event->x() - mLastMousePos.x() ) );
51 view()->verticalScrollBar()->setValue(
view()->verticalScrollBar()->value() - ( event->y() - mLastMousePos.y() ) );
52 mLastMousePos =
event->pos();
57 const bool clickOnly = !
isClickAndDrag( mMousePressStartPos, event->pos() );
59 if ( event->button() == Qt::MiddleButton && clickOnly )
64 const QRect viewportRect( 0, 0,
view()->viewport()->width(),
view()->viewport()->height() );
66 const QPointF scenePoint =
event->modelPoint();
67 visibleRect.
scale( 1, scenePoint.x(), scenePoint.y() );
68 const QRectF boundsRect = visibleRect.
toRectF();
71 view()->fitInView( boundsRect, Qt::KeepAspectRatio );
75 if ( !mIsPanning || event->button() != Qt::LeftButton )
82 view()->setCursor( Qt::OpenHandCursor );
A QgsModelViewMouseEvent is the result of a user interaction with the mouse on a QgsModelGraphicsView...
A rectangle specified with double values.
void scale(double scaleFactor, const QgsPointXY *c=nullptr)
Scale the rectangle around its center point.
QRectF toRectF() const
Returns a QRectF with same coordinates as the rectangle.