21 #include <QMouseEvent> 49 if ( !( e->buttons() & Qt::LeftButton ) )
57 QColor color( Qt::blue );
73 if ( e->button() != Qt::LeftButton )
82 if ( e->button() != Qt::LeftButton )
86 if ( e->modifiers() & Qt::AltModifier )
113 const QSize &zoomRectSize =
mZoomRect.size();
115 const QSize &canvasSize = mapSettings.
outputSize();
116 double sfx = ( double )zoomRectSize.width() / canvasSize.width();
117 double sfy = ( double )zoomRectSize.height() / canvasSize.height();
118 double sf = std::max( sfx, sfy );
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.
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
Get access to properties used for map rendering.
const QgsMapToPixel * getCoordinateTransform()
Get the current coordinate transform.
void setColor(const QColor &color)
Sets the color for the rubberband.
static QCursor getThemeCursor(Cursor cursor)
Helper to get a theme cursor.
QSize outputSize() const
Return the size of the resulting map image.
QgsPointXY toMapCoordinates(int x, int y) const