17#include "moc_qgsmodelviewtoolzoom.cpp"
30 mRubberBand->setBrush( QBrush( QColor( 70, 50, 255, 25 ) ) );
31 mRubberBand->setPen( QPen( QBrush( QColor( 70, 50, 255, 100 ) ), 0 ) );
36 if ( event->button() != Qt::LeftButton )
42 mMousePressStartPos =
event->pos();
43 if ( event->modifiers() & Qt::AltModifier )
46 const double scaleFactor = 2;
48 const QRect viewportRect( 0, 0,
view()->viewport()->width(),
view()->viewport()->height() );
52 const QRectF boundsRect = visibleRect.
toRectF();
55 view()->fitInView( boundsRect, Qt::KeepAspectRatio );
72 mRubberBand->update( event->
modelPoint(), Qt::KeyboardModifiers() );
77 if ( !
mMarqueeZoom || event->button() != Qt::LeftButton )
84 QRectF newBoundsRect = mRubberBand->finish( event->
modelPoint() );
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 );
106 if ( !event->isAutoRepeat() )
116 if ( !event->isAutoRepeat() )
128 mRubberBand->finish();
133void QgsModelViewToolZoom::startMarqueeZoom( QPointF scenePoint )
137 mRubberBandStartPos = scenePoint;
138 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.