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 )
39 mRubberBand->finish();
45 mMousePressStartPos =
event->pos();
46 if ( event->modifiers() & Qt::AltModifier )
49 const double scaleFactor = 2;
51 const QRect viewportRect( 0, 0,
view()->viewport()->width(),
view()->viewport()->height() );
55 const QRectF boundsRect = visibleRect.
toRectF();
58 view()->fitInView( boundsRect, Qt::KeepAspectRatio );
77 mRubberBand->update( event->
layoutPoint(), Qt::KeyboardModifiers() );
82 if ( !
mMarqueeZoom || event->button() != Qt::LeftButton )
89 QRectF newBoundsRect = mRubberBand->finish( event->
layoutPoint() );
95 const double scaleFactor = 0.5;
97 const QRect viewportRect( 0, 0,
view()->viewport()->width(),
view()->viewport()->height() );
101 newBoundsRect = visibleRect.
toRectF();
105 view()->fitInView( newBoundsRect, Qt::KeepAspectRatio );
113 if ( !event->isAutoRepeat() )
116 view()->viewport()->setCursor( ( event->modifiers() & Qt::AltModifier ) ?
126 if ( !event->isAutoRepeat() )
129 view()->viewport()->setCursor( ( event->modifiers() & Qt::AltModifier ) ?
141 mRubberBand->finish();
146void QgsLayoutViewToolZoom::startMarqueeZoom( QPointF scenePoint )
150 mRubberBandStartPos = scenePoint;
151 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.