QGIS API Documentation
3.14.0-Pi (9f7028fd23)
|
Go to the documentation of this file.
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 );
QRectF toRectF() const
Returns a QRectF with same coordinates as the rectangle.
void emitZoomLevelChanged()
Emits the zoomLevelChanged() signal.
void scale(double scaleFactor, const QgsPointXY *c=nullptr)
Scale the rectangle around its center point.
void viewChanged()
Updates associated rulers and other widgets after view extent or zoom has changed.