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();
58 bool clickOnly = !
isClickAndDrag( mMousePressStartPos, event->pos() );
60 if ( event->button() == Qt::MiddleButton && clickOnly )
65 QRect viewportRect( 0, 0,
view()->viewport()->width(),
view()->viewport()->height() );
67 QPointF scenePoint =
event->layoutPoint();
68 visibleRect.
scale( 1, scenePoint.x(), scenePoint.y() );
69 QRectF boundsRect = visibleRect.
toRectF();
72 view()->fitInView( boundsRect, Qt::KeepAspectRatio );
78 if ( !mIsPanning || event->button() != Qt::LeftButton )
87 view()->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.