29 mRubberBand->setBrush( QBrush( QColor( 70, 50, 255, 25 ) ) );
30 mRubberBand->setPen( QPen( QBrush( QColor( 70, 50, 255, 100 ) ), 0 ) );
35 if ( event->button() != Qt::LeftButton )
41 mMousePressStartPos =
event->pos();
42 if ( event->modifiers() & Qt::AltModifier )
45 double scaleFactor = 2;
47 QRect viewportRect( 0, 0,
view()->viewport()->width(),
view()->viewport()->height() );
51 QRectF boundsRect = visibleRect.
toRectF();
54 view()->fitInView( boundsRect, Qt::KeepAspectRatio );
71 mRubberBand->update( event->
modelPoint(), Qt::KeyboardModifiers() );
76 if ( !
mMarqueeZoom || event->button() != Qt::LeftButton )
83 QRectF newBoundsRect = mRubberBand->finish( event->
modelPoint() );
89 double scaleFactor = 0.5;
91 QRect viewportRect( 0, 0,
view()->viewport()->width(),
view()->viewport()->height() );
95 newBoundsRect = visibleRect.
toRectF();
99 view()->fitInView( newBoundsRect, Qt::KeepAspectRatio );
105 if ( !event->isAutoRepeat() )
108 view()->viewport()->setCursor( ( event->modifiers() & Qt::AltModifier ) ?
118 if ( !event->isAutoRepeat() )
121 view()->viewport()->setCursor( ( event->modifiers() & Qt::AltModifier ) ?
133 mRubberBand->finish();
138 void QgsModelViewToolZoom::startMarqueeZoom( QPointF scenePoint )
142 mRubberBandStartPos = scenePoint;
143 mRubberBand->start( scenePoint, Qt::KeyboardModifiers() );
static QCursor getThemeCursor(Cursor cursor)
Helper to get a theme cursor.
A QgsModelViewMouseEvent is the result of a user interaction with the mouse on a QgsModelGraphicsView...
QPointF modelPoint() const
Returns the event point location in model coordinates.
QgsModelViewRectangularRubberBand is rectangular rubber band for use within QgsModelGraphicsView widg...
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.