23#include "moc_qgsmodelviewtoolpan.cpp"
33 mMousePressStartPos =
event->pos();
35 if ( event->button() != Qt::LeftButton )
42 mLastMousePos =
event->pos();
43 view()->viewport()->setCursor( Qt::ClosedHandCursor );
54 view()->horizontalScrollBar()->setValue(
view()->horizontalScrollBar()->value() - ( event->x() - mLastMousePos.x() ) );
55 view()->verticalScrollBar()->setValue(
view()->verticalScrollBar()->value() - ( event->y() - mLastMousePos.y() ) );
56 mLastMousePos =
event->pos();
61 const bool clickOnly = !
isClickAndDrag( mMousePressStartPos, event->pos() );
63 if ( event->button() == Qt::MiddleButton && clickOnly )
68 const QRect viewportRect( 0, 0,
view()->viewport()->width(),
view()->viewport()->height() );
70 const QPointF scenePoint =
event->modelPoint();
71 visibleRect.
scale( 1, scenePoint.x(), scenePoint.y() );
72 const QRectF boundsRect = visibleRect.
toRectF();
75 view()->fitInView( boundsRect, Qt::KeepAspectRatio );
79 if ( !mIsPanning || event->button() != Qt::LeftButton )
86 view()->viewport()->setCursor( Qt::OpenHandCursor );
A mouse event which is the result of a user interaction with 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.