23#include "moc_qgslayoutviewtoolpan.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();
62 const bool clickOnly = !
isClickAndDrag( mMousePressStartPos, event->pos() );
64 if ( event->button() == Qt::MiddleButton && clickOnly )
69 const QRect viewportRect( 0, 0,
view()->viewport()->width(),
view()->viewport()->height() );
71 const QPointF scenePoint =
event->layoutPoint();
72 visibleRect.
scale( 1, scenePoint.x(), scenePoint.y() );
73 const QRectF boundsRect = visibleRect.
toRectF();
76 view()->fitInView( boundsRect, Qt::KeepAspectRatio );
82 if ( !mIsPanning || event->button() != Qt::LeftButton )
91 view()->viewport()->setCursor( Qt::OpenHandCursor );
A mouse event which is the result of a user interaction with a QgsLayoutView.
A graphical widget to display and interact with QgsLayouts.
void viewChanged()
Updates associated rulers and other widgets after view extent or zoom has changed.
void emitZoomLevelChanged()
Emits the zoomLevelChanged() signal.
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.