17#include "moc_qgsmodelviewtoolpan.cpp"
30 mMousePressStartPos =
event->pos();
32 if ( event->button() != Qt::LeftButton )
39 mLastMousePos =
event->pos();
40 view()->viewport()->setCursor( Qt::ClosedHandCursor );
51 view()->horizontalScrollBar()->setValue(
view()->horizontalScrollBar()->value() - ( event->x() - mLastMousePos.x() ) );
52 view()->verticalScrollBar()->setValue(
view()->verticalScrollBar()->value() - ( event->y() - mLastMousePos.y() ) );
53 mLastMousePos =
event->pos();
58 const bool clickOnly = !
isClickAndDrag( mMousePressStartPos, event->pos() );
60 if ( event->button() == Qt::MiddleButton && clickOnly )
65 const QRect viewportRect( 0, 0,
view()->viewport()->width(),
view()->viewport()->height() );
67 const QPointF scenePoint =
event->modelPoint();
68 visibleRect.
scale( 1, scenePoint.x(), scenePoint.y() );
69 const QRectF boundsRect = visibleRect.
toRectF();
72 view()->fitInView( boundsRect, Qt::KeepAspectRatio );
76 if ( !mIsPanning || event->button() != Qt::LeftButton )
83 view()->viewport()->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.