17#include "moc_qgslayoutviewtoolpan.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();
59 const bool clickOnly = !
isClickAndDrag( mMousePressStartPos, event->pos() );
61 if ( event->button() == Qt::MiddleButton && clickOnly )
66 const QRect viewportRect( 0, 0,
view()->viewport()->width(),
view()->viewport()->height() );
68 const QPointF scenePoint =
event->layoutPoint();
69 visibleRect.
scale( 1, scenePoint.x(), scenePoint.y() );
70 const QRectF boundsRect = visibleRect.
toRectF();
73 view()->fitInView( boundsRect, Qt::KeepAspectRatio );
79 if ( !mIsPanning || event->button() != Qt::LeftButton )
88 view()->viewport()->setCursor( Qt::OpenHandCursor );
A QgsLayoutViewMouseEvent is the result of a user interaction with the mouse on 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.