35 , mNativeZoomOut( zoomOut )
53 if ( !( e->buttons() & Qt::LeftButton ) )
56 setZoomMode( e->modifiers().testFlag( Qt::AltModifier ) ^
mNativeZoomOut );
63 QColor color( Qt::blue );
80 if ( e->button() != Qt::LeftButton )
89 if ( e->button() != Qt::LeftButton )
92 setZoomMode( e->modifiers().testFlag( Qt::AltModifier ) ^
mNativeZoomOut );
121 const QSize &zoomRectSize =
mZoomRect.size();
123 const QSize &canvasSize = mapSettings.
outputSize();
124 double sfx =
static_cast<double>( zoomRectSize.width() ) / canvasSize.width();
125 double sfy =
static_cast<double>( zoomRectSize.height() ) / canvasSize.height();
126 double sf = std::max( sfx, sfy );
145 void QgsMapToolZoom::setZoomMode(
bool zoomOut,
bool force )
147 if ( !force && zoomOut ==
mZoomOut )
156 if ( e->key() == Qt::Key_Alt )
167 if ( e->key() == Qt::Key_Alt )
Extends QApplication to provide access to QGIS specific resources such as theme paths, database paths etc.
void zoomWithCenter(int x, int y, bool zoomIn)
Zooms in/out with a given center.
void setToCanvasRectangle(QRect rect)
Sets this rubber band to a map canvas rectangle.
A class to represent a 2D point.
A QgsMapMouseEvent is the result of a user interaction with the mouse on a QgsMapCanvas.
void refresh()
Repaints the canvas map.
Map canvas is a class for displaying all GIS data types on a canvas.
The QgsMapSettings class contains configuration for rendering of the map.
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
Perform transforms between map coordinates and device coordinates.
A class for drawing transient features (e.g.
void zoomByFactor(double scaleFactor, const QgsPointXY *center=nullptr)
Zoom with the factor supplied.
const QgsMapSettings & mapSettings() const
Gets access to properties used for map rendering.
const QgsMapToPixel * getCoordinateTransform()
Gets the current coordinate transform.
void setColor(const QColor &color)
Sets the color for the rubberband.
QSize outputSize() const
Returns the size of the resulting map image.
QgsPointXY toMapCoordinates(int x, int y) const
Transform device coordinates to map (world) coordinates.