QgsMapToolEdit class

Base class for map tools that edit vector geometry.

Base classes

class QgsMapTool
Abstract base class for all map tools.

Derived classes

class QgsMapToolAdvancedDigitizing
The QgsMapToolAdvancedDigitizing class is a QgsMapTool which gives event directly in map coordinates and allows filtering its events.

Public functions

auto defaultZValue() const -> double
Returns default Z value Use for set Z coordinate to new vertex for 2.5d geometries.
auto flags() const -> Flags override
Returns the flags for the map tool.

Protected static functions

static auto digitizingFillColor() -> QColor
Returns fill color for rubber bands (from global settings)
static auto digitizingStrokeColor() -> QColor
Returns stroke color for rubber bands (from global settings)
static auto digitizingStrokeWidth() -> int
Returns stroke width for rubber bands (from global settings)

Protected functions

auto addTopologicalPoints(const QVector<QgsPointXY>& geom) -> int
Adds vertices to other features to keep topology up to date, e.g.
auto createRubberBand(QgsWkbTypes::GeometryType geometryType = QgsWkbTypes::LineGeometry, bool alternativeBand = false) -> QgsRubberBand*
Creates a rubber band with the color/line width from the QGIS settings.
auto currentVectorLayer() -> QgsVectorLayer*
Returns the current vector layer of the map canvas or 0.
void notifyNotEditableLayer()
Display a timed message bar noting the active vector layer is not editable.
void notifyNotVectorLayer()
Display a timed message bar noting the active layer is not vector.

Function documentation

Flags QgsMapToolEdit::flags() const override

Returns the flags for the map tool.

int QgsMapToolEdit::addTopologicalPoints(const QVector<QgsPointXY>& geom) protected

Adds vertices to other features to keep topology up to date, e.g.

Parameters
geom list of points (in layer coordinate system)
Returns 0 in case of success

to neighbouring polygons.

QgsRubberBand* QgsMapToolEdit::createRubberBand(QgsWkbTypes::GeometryType geometryType = QgsWkbTypes::LineGeometry, bool alternativeBand = false) protected

Creates a rubber band with the color/line width from the QGIS settings.

Parameters
geometryType
alternativeBand if true, rubber band will be set with more transparency and a dash pattern. default is false.

The caller takes ownership of the returned object