QgsMapToolExtent class
A map tool that emits an extent from a rectangle drawn onto the map canvas.
Contents
Base classes
- class QgsMapTool
- Abstract base class for all map tools.
Constructors, destructors, conversion operators
- QgsMapToolExtent(QgsMapCanvas* canvas)
- constructor
Public functions
- void activate() override
- called when set as currently active map tool
- void canvasMoveEvent(QgsMapMouseEvent* e) override
- Mouse move event for overriding. Default implementation does nothing.
- void canvasPressEvent(QgsMapMouseEvent* e) override
- Mouse press event for overriding. Default implementation does nothing.
- void canvasReleaseEvent(QgsMapMouseEvent* e) override
- Mouse release event for overriding. Default implementation does nothing.
- void deactivate() override
- called when map tool is being deactivated
- auto extent() const -> QgsRectangle
- Returns the current extent drawn onto the canvas.
- auto flags() const -> Flags override
- Returns the flags for the map tool.
- auto ratio() const -> QSize
- Returns the current fixed aspect ratio to be used when dragging extent onto the canvas.
- void setRatio(QSize ratio)
- Sets a fixed aspect ratio to be used when dragging extent onto the canvas.
Signals
- void extentChanged(const QgsRectangle& extent)
- signal emitted on extent change
Function documentation
Flags QgsMapToolExtent:: flags() const override
Returns the flags for the map tool.
QSize QgsMapToolExtent:: ratio() const
Returns the current fixed aspect ratio to be used when dragging extent onto the canvas.
If the aspect ratio isn't fixed, the width and height will be set to zero.
void QgsMapToolExtent:: setRatio(QSize ratio)
Sets a fixed aspect ratio to be used when dragging extent onto the canvas.
| Parameters | |
|---|---|
| ratio | aspect ratio's width and height |
To unset a fixed aspect ratio, set the width and height to zero.