28 mRubberBand->setBrush( QBrush( QColor( 70, 50, 255, 25 ) ) );
29 mRubberBand->setPen( QPen( QBrush( QColor( 70, 50, 255, 100 ) ), 0 ) );
34 if ( event->button() != Qt::LeftButton )
40 mMousePressStartPos =
event->pos();
41 if ( event->modifiers() & Qt::AltModifier )
44 const double scaleFactor = 2;
46 const QRect viewportRect( 0, 0,
view()->viewport()->width(),
view()->viewport()->height() );
50 const QRectF boundsRect = visibleRect.
toRectF();
53 view()->fitInView( boundsRect, Qt::KeepAspectRatio );
72 mRubberBand->update( event->
layoutPoint(), Qt::KeyboardModifiers() );
77 if ( !
mMarqueeZoom || event->button() != Qt::LeftButton )
84 QRectF newBoundsRect = mRubberBand->finish( event->
layoutPoint() );
90 const double scaleFactor = 0.5;
92 const QRect viewportRect( 0, 0,
view()->viewport()->width(),
view()->viewport()->height() );
96 newBoundsRect = visibleRect.
toRectF();
100 view()->fitInView( newBoundsRect, Qt::KeepAspectRatio );
108 if ( !event->isAutoRepeat() )
111 view()->viewport()->setCursor( ( event->modifiers() & Qt::AltModifier ) ?
121 if ( !event->isAutoRepeat() )
124 view()->viewport()->setCursor( ( event->modifiers() & Qt::AltModifier ) ?
136 mRubberBand->finish();
141 void QgsLayoutViewToolZoom::startMarqueeZoom( QPointF scenePoint )
145 mRubberBandStartPos = scenePoint;
146 mRubberBand->start( scenePoint, Qt::KeyboardModifiers() );
static QCursor getThemeCursor(Cursor cursor)
Helper to get a theme cursor.
A QgsLayoutViewMouseEvent is the result of a user interaction with the mouse on a QgsLayoutView.
QPointF layoutPoint() const
Returns the event point location in layout coordinates.
QgsLayoutViewRectangularRubberBand is rectangular rubber band for use within QgsLayoutView widgets.
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.