Class: QgsAdvancedDigitizingDockWidget

The QgsAdvancedDigitizingDockWidget class is a dockable widget used to handle the CAD tools on top of a selection of map tools. It handles both the UI and the constraints. Constraints are applied by implementing filters called from QgsMapToolAdvancedDigitizing.

QgsAdvancedDigitizingDockWidget

QgsAdvancedDigitizingDockWidget

Class Hierarchy

Inheritance diagram of qgis.gui.QgsAdvancedDigitizingDockWidget

Base classes

QgsDockWidget

QgsDockWidget subclass with more fine-grained control over how the widget is closed or opened.

QDockWidget

QWidget

QObject

QPaintDevice

Methods

addPoint

Adds point to the CAD point list

alignToSegment

align to segment for between line constraint.

applyConstraints

apply the CAD constraints.

betweenLineConstraint

Returns the between line constraints which are used to place perpendicular/parallel segments to snapped segments on the canvas

cadEnabled

determines if CAD tools are enabled or if map tools behaves "nomally"

canvasKeyPressEventFilter

Filter key events to e.g. toggle construction mode or adapt constraints.

capacities

Returns the capacities

clear

Clear any cached previous clicks and helper lines

clearLockedSnapVertices

Removes all points from the locked snap vertex list

clearPoints

Removes all points from the CAD point list

commonAngleConstraint

Returns True if a constraint on a common angle is active

constraintAngle

Returns the CadConstraint on the angle

constraintDistance

Returns the CadConstraint on the distance

constraintLineExtension

Returns the CadConstraint

constraintM

Returns the CadConstraint on the M coordinate

constraintX

Returns the CadConstraint on the X coordinate

constraintXyVertex

Returns the CadConstraint

constraintY

Returns the CadConstraint on the Y coordinate

constraintZ

Returns the CadConstraint on the Z coordinate

constructionGuidesLayer

Returns the vector layer within which construction guides are stored.

constructionMode

Returns whether the construction mode is activated.

currentPoint

The last point.

currentPointLayerCoordinates

Returns the last CAD point, in a map layer's coordinates.

currentPointV2

The last point.

disable

Disable the widget.

enable

Enables the tool (call this when an appropriate map tool is set and in the condition to make use of cad digitizing) Normally done automatically from QgsMapToolAdvancedDigitizing.activate() but may need to be fine tuned if the map tool depends on preconditions like a feature selection.

enableAction

Returns the action used to enable/disable the tools

formatCommonAngleSnapping

Returns the formatted label for common angle snapping option.

getLineM

Convenient method to get the M value from the line edit wiget

getLineZ

Convenient method to get the Z value from the line edit wiget

lineExtensionSide

Returns on which side of the constraint line extension point, the line was created

lockedSnapVertices

Returns the snap matches whose vertices have been locked

mapPointMatch

Returns the point locator match

penultimatePoint

The penultimate point.

penultimatePointV2

The penultimate point.

pointsCount

The number of points in the CAD point helper list

previousPoint

The previous point.

previousPointV2

The previous point.

processCanvasMoveEvent

Processes the canvas move event.

processCanvasPressEvent

Processes the canvas press event.

processCanvasReleaseEvent

Processes the canvas release event.

recordConstructionGuides

Returns whether construction guides are being recorded.

releaseLocks

unlock all constraints

removePreviousPoint

Removes previous point in the CAD point list

setAngle

Set the angle value on the widget.

setDistance

Set the distance value on the widget.

setEnabledM

Sets whether M is enabled

setEnabledZ

Sets whether Z is enabled

setM

Set the M value on the widget.

setPoints

Configures list of current CAD points

setTool

Sets an advanced digitizing tool which will take over digitizing until the tool is close.

setX

Set the X value on the widget.

setY

Set the Y value on the widget.

setZ

Set the Z value on the widget.

showConstructionGuides

Returns whether the construction guides are visible.

snapToConstructionGuides

Returns whether points should snap to construction guides.

snappedSegment

Snapped to a segment

snappedToVertex

Is it snapped to a vertex

softLockX

Returns the X value of the X soft lock.

softLockY

Returns the Y value of the Y soft lock.

switchZM

Determines if Z or M will be enabled.

toggleConstraintDistance

Toggles the distance constraint.

tool

Returns the current advanced digitizing tool.

updateCadPaintItem

Updates canvas item that displays constraints on the ma

updateCurrentPoint

Updates the current point in the CAD point list

Signals

cadEnabledChanged

Emitted whenever CAD is enabled or disabled

enabledChangedAngle

Emitted whenever the angle field is enabled or disabled.

enabledChangedDistance

Emitted whenever the distance field is enabled or disabled.

enabledChangedM

Emitted whenever the M field is enabled or disabled.

enabledChangedX

Emitted whenever the X field is enabled or disabled.

enabledChangedY

Emitted whenever the Y field is enabled or disabled.

enabledChangedZ

Emitted whenever the Z field is enabled or disabled.

focusOnAngleRequested

Emitted whenever the angle field should get the focus using the shortcuts (A).

focusOnDistanceRequested

Emitted whenever the distance field should get the focus using the shortcuts (D).

focusOnMRequested

Emitted whenever the M field should get the focus using the shortcuts (M).

focusOnXRequested

Emitted whenever the X field should get the focus using the shortcuts (X).

focusOnYRequested

Emitted whenever the Y field should get the focus using the shortcuts (Y).

focusOnZRequested

Emitted whenever the Z field should get the focus using the shortcuts (Z).

lockAngleChanged

Emitted whenever the angle parameter is locked.

lockDistanceChanged

Emitted whenever the distance parameter is locked.

lockMChanged

Emitted whenever the M parameter is locked.

lockXChanged

Emitted whenever the X parameter is locked.

lockYChanged

Emitted whenever the Y parameter is locked.

lockZChanged

Emitted whenever the Z parameter is locked.

pointChanged

Sometimes a constraint may change the current point out of a mouse event.

pointChangedV2

Sometimes a constraint may change the current point out of a mouse event.

popWarning

Remove any previously emitted warnings (if any)

pushWarning

Push a warning

relativeAngleChanged

Emitted whenever the angleX parameter is toggled between absolute and relative.

relativeMChanged

Emitted whenever the M parameter is toggled between absolute and relative.

relativeXChanged

Emitted whenever the X parameter is toggled between absolute and relative.

relativeYChanged

Emitted whenever the Y parameter is toggled between absolute and relative.

relativeZChanged

Emitted whenever the Z parameter is toggled between absolute and relative.

softLockLineExtensionChanged

Emitted whenever the soft line extension parameter is locked.

softLockXyChanged

Emitted whenever the soft x/y extension parameter is locked.

valueAngleChanged

Emitted whenever the angle value changes (either the mouse moved, or the user changed the input).

valueBearingChanged

Emitted whenever the bearing value changes.

valueCommonAngleSnappingChanged

Emitted whenever the snapping to common angle option changes, angle = 0 means that the functionality is disabled.

valueDistanceChanged

Emitted whenever the distance value changes (either the mouse moved, or the user changed the input).

valueMChanged

Emitted whenever the M value changes (either the mouse moved, or the user changed the input).

valueXChanged

Emitted whenever the X value changes (either the mouse moved, or the user changed the input).

valueYChanged

Emitted whenever the Y value changes (either the mouse moved, or the user changed the input).

valueZChanged

Emitted whenever the Z value changes (either the mouse moved, or the user changed the input).

Attributes

AbsoluteAngle

Distance

FocusOut

RelativeAngle

RelativeCoordinates

ReturnPressed

TextEdited

class qgis.gui.QgsAdvancedDigitizingDockWidget[source]

Bases: QgsDockWidget

__init__(canvas: QgsMapCanvas | None, parent: QWidget | None = None, userInputWidget: QgsUserInputWidget | None = None)

Create an advanced digitizing dock widget

Parameters:
  • canvas (Optional[QgsMapCanvas]) – The map canvas on which the widget operates

  • parent (Optional[QWidget] = None) – The parent

  • userInputWidget (Optional[QgsUserInputWidget] = None) – The user input widget on which tools can add widget overlays on top of the map canvas (since QGIS 3.40)

AbsoluteAngle = 1
class CadCapacities
class CadCapacities(f: QgsAdvancedDigitizingDockWidget.CadCapacities | QgsAdvancedDigitizingDockWidget.CadCapacity)
class CadCapacities(a0: QgsAdvancedDigitizingDockWidget.CadCapacities)

Bases: object

class CadCapacity

Bases: int

class CadConstraint[source]

Bases: object

The CadConstraint is a class for all basic constraints (angle/distance/x/y). It contains all values (locked, value, relative) and pointers to corresponding widgets.

Note

Relative is not mandatory since it is not used for distance.

QgsAdvancedDigitizingDockWidget.CadConstraint(lineEdit: Optional[QLineEdit], lockerButton: Optional[QToolButton], relativeButton: Optional[QToolButton] = None, repeatingLockButton: Optional[QToolButton] = None) Constructor for CadConstraint.

Parameters:
  • lineEdit – associated line edit for constraint value

  • lockerButton – associated button for locking constraint

  • relativeButton – optional button for toggling relative constraint mode

  • repeatingLockButton – optional button for toggling repeating lock mode

QgsAdvancedDigitizingDockWidget.CadConstraint(a0: QgsAdvancedDigitizingDockWidget.CadConstraint)

HardLock = 2
class LockMode

Bases: int

NoLock = 0
SoftLock = 1
cadConstraintType(self) Qgis.CadConstraintType[source]

Returns the constraint type

Added in version 3.32.

Return type:

Qgis.CadConstraintType

displayValue(self) str[source]

Returns a localized formatted string representation of the value.

Added in version 3.32.

Return type:

str

isLocked(self) bool[source]

Is any kind of lock mode enabled

Return type:

bool

isRepeatingLock(self) bool[source]

Returns True if a repeating lock is set for the constraint. Repeating locks are not automatically cleared after a new point is added.

Return type:

bool

lineEdit(self) QLineEdit | None[source]

The line edit that manages the value of the constraint

Return type:

Optional[QLineEdit]

lockMode(self) QgsAdvancedDigitizingDockWidget.CadConstraint.LockMode[source]

The current lock mode of this constraint

Return type:

QgsAdvancedDigitizingDockWidget.CadConstraint.LockMode

Returns:

Lock mode

precision(self) int[source]

Returns the numeric precision (decimal places) to show in the associated widget.

See also

setPrecision()

Added in version 3.22.

Return type:

int

relative(self) bool[source]

Is the constraint in relative mode

Return type:

bool

static removeSuffix(text: str | None, constraintType: Qgis.CadConstraintType) str[source]

Removes unit suffix from the constraint text.

Added in version 3.34.

Parameters:
Return type:

str

setCadConstraintType(self, constraintType: Qgis.CadConstraintType)[source]

Sets the constraint type to constraintType

Added in version 3.32.

Parameters:

constraintType (Qgis.CadConstraintType)

setLockMode(self, mode: QgsAdvancedDigitizingDockWidget.CadConstraint.LockMode)[source]

Set the lock mode

Parameters:

mode (QgsAdvancedDigitizingDockWidget.CadConstraint.LockMode)

setMapCanvas(self, mapCanvas: QgsMapCanvas | None)[source]

Sets the map canvas to mapCanvas

Added in version 3.32.

Parameters:

mapCanvas (Optional[QgsMapCanvas])

setPrecision(self, precision: int)[source]

Sets the numeric precision (decimal places) to show in the associated widget.

See also

precision()

Added in version 3.22.

Parameters:

precision (int)

setRelative(self, relative: bool)[source]

Set if the constraint should be treated relative

Parameters:

relative (bool)

setRepeatingLock(self, repeating: bool)[source]

Sets whether a repeating lock is set for the constraint. Repeating locks are not automatically cleared after a new point is added.

Parameters:

repeating (bool) – set to True to set the lock to repeat automatically

setValue(self, value: float, updateWidget: bool = True)[source]

Set the value of the constraint

Parameters:
  • value (float) – new value for constraint

  • updateWidget (bool = True) – set to False to prevent automatically updating the associated widget’s value

toggleLocked(self)[source]

Toggle lock mode

toggleRelative(self)[source]

Toggle relative mode

value(self) float[source]

The value of the constraint

Return type:

float

Distance = 8
FocusOut = 1
RelativeAngle = 2
RelativeCoordinates = 4
ReturnPressed = 0
TextEdited = 2
class WidgetSetMode

Bases: int

addPoint(self, point: QgsPointXY)[source]

Adds point to the CAD point list

Parameters:

point (QgsPointXY)

alignToSegment(self, e: QgsMapMouseEvent | None, lockMode: QgsAdvancedDigitizingDockWidget.CadConstraint.LockMode = QgsAdvancedDigitizingDockWidget.CadConstraint.HardLock) bool[source]

align to segment for between line constraint. If between line constraints are used, this will determine the angle to be locked depending on the snapped segment.

Parameters:
  • e (Optional[QgsMapMouseEvent])

  • lockMode (QgsAdvancedDigitizingDockWidget.CadConstraint.LockMode = QgsAdvancedDigitizingDockWidget.CadConstraint.HardLock)

Return type:

bool

applyConstraints(self, e: QgsMapMouseEvent | None) bool[source]

apply the CAD constraints. The will modify the position of the map event in map coordinates by applying the CAD constraints.

Return type:

bool

Returns:

False if no solution was found (invalid constraints)

Parameters:

e (Optional[QgsMapMouseEvent])

betweenLineConstraint(self) Qgis.BetweenLineConstraint[source]

Returns the between line constraints which are used to place perpendicular/parallel segments to snapped segments on the canvas

Return type:

Qgis.BetweenLineConstraint

cadEnabled(self) bool[source]

determines if CAD tools are enabled or if map tools behaves “nomally”

Return type:

bool

signal cadEnabledChanged(enabled: bool)[source]

Emitted whenever CAD is enabled or disabled

Parameters:

enabled (bool) – Whether CAD is enabled or not

Note

unstable API (will likely change).

Added in version 3.8.

canvasKeyPressEventFilter(self, e: QKeyEvent | None) bool[source]

Filter key events to e.g. toggle construction mode or adapt constraints

Parameters:

e (Optional[QKeyEvent]) – A mouse event (may be modified)

Return type:

bool

Returns:

If the event is hidden (construction mode hides events from the maptool)

capacities(self) QgsAdvancedDigitizingDockWidget.CadCapacities[source]

Returns the capacities

Added in version 3.26.

Return type:

QgsAdvancedDigitizingDockWidget.CadCapacities

clear(self)[source]

Clear any cached previous clicks and helper lines

clearLockedSnapVertices(self, force: bool = True)[source]

Removes all points from the locked snap vertex list

Parameters:

force (bool = True) – Clears the list even if the constraints that use it are still locked.

Added in version 3.26.

clearPoints(self)[source]

Removes all points from the CAD point list

commonAngleConstraint(self) bool[source]

Returns True if a constraint on a common angle is active

Return type:

bool

constraintAngle(self) QgsAdvancedDigitizingDockWidget.CadConstraint | None[source]

Returns the CadConstraint on the angle

Return type:

Optional[QgsAdvancedDigitizingDockWidget.CadConstraint]

constraintDistance(self) QgsAdvancedDigitizingDockWidget.CadConstraint | None[source]

Returns the CadConstraint on the distance

Return type:

Optional[QgsAdvancedDigitizingDockWidget.CadConstraint]

constraintLineExtension(self) QgsAdvancedDigitizingDockWidget.CadConstraint | None[source]

Returns the CadConstraint

Return type:

Optional[QgsAdvancedDigitizingDockWidget.CadConstraint]

constraintM(self) QgsAdvancedDigitizingDockWidget.CadConstraint | None[source]

Returns the CadConstraint on the M coordinate

Added in version 3.22.

Return type:

Optional[QgsAdvancedDigitizingDockWidget.CadConstraint]

constraintX(self) QgsAdvancedDigitizingDockWidget.CadConstraint | None[source]

Returns the CadConstraint on the X coordinate

Return type:

Optional[QgsAdvancedDigitizingDockWidget.CadConstraint]

constraintXyVertex(self) QgsAdvancedDigitizingDockWidget.CadConstraint | None[source]

Returns the CadConstraint

Return type:

Optional[QgsAdvancedDigitizingDockWidget.CadConstraint]

constraintY(self) QgsAdvancedDigitizingDockWidget.CadConstraint | None[source]

Returns the CadConstraint on the Y coordinate

Return type:

Optional[QgsAdvancedDigitizingDockWidget.CadConstraint]

constraintZ(self) QgsAdvancedDigitizingDockWidget.CadConstraint | None[source]

Returns the CadConstraint on the Z coordinate

Added in version 3.22.

Return type:

Optional[QgsAdvancedDigitizingDockWidget.CadConstraint]

constructionGuidesLayer(self) QgsVectorLayer | None[source]

Returns the vector layer within which construction guides are stored.

Added in version 3.40.

Return type:

Optional[QgsVectorLayer]

constructionMode(self) bool[source]

Returns whether the construction mode is activated. The construction mode is used to draw intermediate points that will not be part of a geometry being digitized.

Return type:

bool

currentPoint(self)[source]

The last point. Helper for the CAD point list. The CAD point list is the list of points currently digitized. It contains both “normal” points and intermediate points (construction mode).

Deprecated since version 3.22: Use currentPointV2() instead.

currentPointLayerCoordinates(self, layer: QgsMapLayer | None) QgsPoint[source]

Returns the last CAD point, in a map layer’s coordinates.

Added in version 3.22.

Parameters:

layer (Optional[QgsMapLayer])

Return type:

QgsPoint

currentPointV2(self)[source]

The last point. Helper for the CAD point list. The CAD point list is the list of points currently digitized. It contains both “normal” points and intermediate points (construction mode).

Added in version 3.22.

disable(self)[source]

Disable the widget. Normally done automatically from QgsMapToolAdvancedDigitizing.deactivate().

enable(self)[source]

Enables the tool (call this when an appropriate map tool is set and in the condition to make use of cad digitizing) Normally done automatically from QgsMapToolAdvancedDigitizing.activate() but may need to be fine tuned if the map tool depends on preconditions like a feature selection.

enableAction(self) QAction | None[source]

Returns the action used to enable/disable the tools

Return type:

Optional[QAction]

signal enabledChangedAngle(enabled: bool)[source]

Emitted whenever the angle field is enabled or disabled. Depending on the context, some parameters do not make sense (e.g. you need a previous point to define a distance). Could be used by widgets that must reflect the current advanced digitizing state.

Parameters:

enabled (bool) – Whether the angle parameter is enabled or not.

Note

unstable API (will likely change)

Added in version 3.8.

signal enabledChangedDistance(enabled: bool)[source]

Emitted whenever the distance field is enabled or disabled. Depending on the context, some parameters do not make sense (e.g. you need a previous point to define a distance). Could be used by widgets that must reflect the current advanced digitizing state.

Parameters:

enabled (bool) – Whether the distance parameter is enabled or not.

Note

unstable API (will likely change)

Added in version 3.8.

signal enabledChangedM(enabled: bool)[source]

Emitted whenever the M field is enabled or disabled. Depending on the context, some parameters do not make sense (e.g. you need a previous point to define a distance). Could be used by widgets that must reflect the current advanced digitizing state.

Parameters:

enabled (bool) – Whether the M parameter is enabled or not.

Note

unstable API (will likely change)

Added in version 3.22.

signal enabledChangedX(enabled: bool)[source]

Emitted whenever the X field is enabled or disabled. Depending on the context, some parameters do not make sense (e.g. you need a previous point to define a distance). Could be used by widgets that must reflect the current advanced digitizing state.

Parameters:

enabled (bool) – Whether the X parameter is enabled or not.

Note

unstable API (will likely change)

Added in version 3.8.

signal enabledChangedY(enabled: bool)[source]

Emitted whenever the Y field is enabled or disabled. Depending on the context, some parameters do not make sense (e.g. you need a previous point to define a distance). Could be used by widgets that must reflect the current advanced digitizing state.

Parameters:

enabled (bool) – Whether the Y parameter is enabled or not.

Note

unstable API (will likely change)

Added in version 3.8.

signal enabledChangedZ(enabled: bool)[source]

Emitted whenever the Z field is enabled or disabled. Depending on the context, some parameters do not make sense (e.g. you need a previous point to define a distance). Could be used by widgets that must reflect the current advanced digitizing state.

Parameters:

enabled (bool) – Whether the Z parameter is enabled or not.

Note

unstable API (will likely change)

Added in version 3.22.

signal focusOnAngleRequested[source]

Emitted whenever the angle field should get the focus using the shortcuts (A). Could be used by widgets to capture the focus when a field is being edited.

Note

unstable API (will likely change)

Added in version 3.8.

signal focusOnDistanceRequested[source]

Emitted whenever the distance field should get the focus using the shortcuts (D). Could be used by widgets to capture the focus when a field is being edited.

Note

unstable API (will likely change)

Added in version 3.8.

signal focusOnMRequested[source]

Emitted whenever the M field should get the focus using the shortcuts (M). Could be used by widgets to capture the focus when a field is being edited.

Note

unstable API (will likely change)

Added in version 3.22.

signal focusOnXRequested[source]

Emitted whenever the X field should get the focus using the shortcuts (X). Could be used by widgets to capture the focus when a field is being edited.

Note

unstable API (will likely change)

Added in version 3.8.

signal focusOnYRequested[source]

Emitted whenever the Y field should get the focus using the shortcuts (Y). Could be used by widgets to capture the focus when a field is being edited.

Note

unstable API (will likely change)

Added in version 3.8.

signal focusOnZRequested[source]

Emitted whenever the Z field should get the focus using the shortcuts (Z). Could be used by widgets to capture the focus when a field is being edited.

Note

unstable API (will likely change)

Added in version 3.22.

formatCommonAngleSnapping(self, angle: float) str[source]

Returns the formatted label for common angle snapping option.

Added in version 3.32.

Parameters:

angle (float)

Return type:

str

getLineM(self) float[source]

Convenient method to get the M value from the line edit wiget

Added in version 3.22.

Return type:

float

getLineZ(self) float[source]

Convenient method to get the Z value from the line edit wiget

Added in version 3.22.

Return type:

float

lineExtensionSide(self) Qgis.LineExtensionSide[source]

Returns on which side of the constraint line extension point, the line was created

Return type:

Qgis.LineExtensionSide

signal lockAngleChanged(locked: bool)[source]

Emitted whenever the angle parameter is locked. Could be used by widgets that must reflect the current advanced digitizing state.

Note

unstable API (will likely change)

Added in version 3.8.

Parameters:

locked (bool)

signal lockDistanceChanged(locked: bool)[source]

Emitted whenever the distance parameter is locked. Could be used by widgets that must reflect the current advanced digitizing state.

Note

unstable API (will likely change)

Added in version 3.8.

Parameters:

locked (bool)

signal lockMChanged(locked: bool)[source]

Emitted whenever the M parameter is locked. Could be used by widgets that must reflect the current advanced digitizing state.

Note

unstable API (will likely change)

Added in version 3.22.

Parameters:

locked (bool)

signal lockXChanged(locked: bool)[source]

Emitted whenever the X parameter is locked. Could be used by widgets that must reflect the current advanced digitizing state.

Note

unstable API (will likely change)

Added in version 3.8.

Parameters:

locked (bool)

signal lockYChanged(locked: bool)[source]

Emitted whenever the Y parameter is locked. Could be used by widgets that must reflect the current advanced digitizing state.

Note

unstable API (will likely change)

Added in version 3.8.

Parameters:

locked (bool)

signal lockZChanged(locked: bool)[source]

Emitted whenever the Z parameter is locked. Could be used by widgets that must reflect the current advanced digitizing state.

Note

unstable API (will likely change)

Added in version 3.22.

Parameters:

locked (bool)

lockedSnapVertices(self) List[QgsPointLocator.Match]

Returns the snap matches whose vertices have been locked

Added in version 3.26.

Return type:

List[QgsPointLocator.Match]

mapPointMatch(self) QgsPointLocator.Match[source]

Returns the point locator match

Added in version 3.4.

Return type:

QgsPointLocator.Match

penultimatePoint(self)[source]

The penultimate point. Helper for the CAD point list. The CAD point list is the list of points currently digitized. It contains both “normal” points and intermediate points (construction mode).

Deprecated since version 3.22: Use penultimatePointV2() instead.

penultimatePointV2(self)[source]

The penultimate point. Helper for the CAD point list. The CAD point list is the list of points currently digitized. It contains both “normal” points and intermediate points (construction mode).

signal pointChanged[source]

Sometimes a constraint may change the current point out of a mouse event. This happens normally when a constraint is toggled.

Parameters:

point – The last known digitizing point. Can be used to emulate a mouse event.

Deprecated since version 3.22: No longer used, will be removed in QGIS 4.0. Use pointChangedV2 instead.

signal pointChangedV2(point: QgsPoint)[source]

Sometimes a constraint may change the current point out of a mouse event. This happens normally when a constraint is toggled.

Parameters:

point (QgsPoint) – The last known digitizing point. Can be used to emulate a mouse event.

Added in version 3.22.

pointsCount(self) int[source]

The number of points in the CAD point helper list

Return type:

int

signal popWarning[source]

Remove any previously emitted warnings (if any)

previousPoint(self)[source]

The previous point. Helper for the CAD point list. The CAD point list is the list of points currently digitized. It contains both “normal” points and intermediate points (construction mode).

Deprecated since version 3.22: Use previousPointV2() instead.

previousPointV2(self)[source]

The previous point. Helper for the CAD point list. The CAD point list is the list of points currently digitized. It contains both “normal” points and intermediate points (construction mode).

processCanvasMoveEvent(self, event: QgsMapMouseEvent | None)[source]

Processes the canvas move event.

Parameters:

event (Optional[QgsMapMouseEvent])

processCanvasPressEvent(self, event: QgsMapMouseEvent | None)[source]

Processes the canvas press event.

Parameters:

event (Optional[QgsMapMouseEvent])

processCanvasReleaseEvent(self, event: QgsMapMouseEvent | None)[source]

Processes the canvas release event.

Parameters:

event (Optional[QgsMapMouseEvent])

signal pushWarning(message: str)[source]

Push a warning

Parameters:

message (str) – An informative message

recordConstructionGuides(self) bool[source]

Returns whether construction guides are being recorded.

Added in version 3.40.

Return type:

bool

signal relativeAngleChanged(relative: bool)[source]

Emitted whenever the angleX parameter is toggled between absolute and relative. Could be used by widgets that must reflect the current advanced digitizing state.

Parameters:

relative (bool) – Whether the angle parameter is relative or not.

Note

unstable API (will likely change)

Added in version 3.8.

signal relativeMChanged(relative: bool)[source]

Emitted whenever the M parameter is toggled between absolute and relative. Could be used by widgets that must reflect the current advanced digitizing state.

Parameters:

relative (bool) – Whether the M parameter is relative or not.

Note

unstable API (will likely change)

Added in version 3.22.

signal relativeXChanged(relative: bool)[source]

Emitted whenever the X parameter is toggled between absolute and relative. Could be used by widgets that must reflect the current advanced digitizing state.

Parameters:

relative (bool) – Whether the X parameter is relative or not.

Note

unstable API (will likely change)

Added in version 3.8.

signal relativeYChanged(relative: bool)[source]

Emitted whenever the Y parameter is toggled between absolute and relative. Could be used by widgets that must reflect the current advanced digitizing state.

Parameters:

relative (bool) – Whether the Y parameter is relative or not.

Note

unstable API (will likely change)

Added in version 3.8.

signal relativeZChanged(relative: bool)[source]

Emitted whenever the Z parameter is toggled between absolute and relative. Could be used by widgets that must reflect the current advanced digitizing state.

Parameters:

relative (bool) – Whether the Z parameter is relative or not.

Note

unstable API (will likely change)

Added in version 3.22.

releaseLocks(self, releaseRepeatingLocks: bool = True)[source]

unlock all constraints

Parameters:

releaseRepeatingLocks (bool = True) – set to False to preserve the lock for any constraints set to repeating lock mode

removePreviousPoint(self)[source]

Removes previous point in the CAD point list

Added in version 3.8.

setAngle(self, value: str | None, mode: QgsAdvancedDigitizingDockWidget.WidgetSetMode)[source]

Set the angle value on the widget. Can be used to set constraints by external widgets.

Parameters:

Note

unstable API (will likely change)

Added in version 3.8.

setDistance(self, value: str | None, mode: QgsAdvancedDigitizingDockWidget.WidgetSetMode)[source]

Set the distance value on the widget. Can be used to set constraints by external widgets.

Parameters:

Note

unstable API (will likely change)

Added in version 3.8.

setEnabledM(self, enable: bool)[source]

Sets whether M is enabled

Added in version 3.22.

Parameters:

enable (bool)

setEnabledZ(self, enable: bool)[source]

Sets whether Z is enabled

Added in version 3.22.

Parameters:

enable (bool)

setM(self, value: str | None, mode: QgsAdvancedDigitizingDockWidget.WidgetSetMode)[source]

Set the M value on the widget. Can be used to set constraints by external widgets.

Parameters:

Note

unstable API (will likely change)

Added in version 3.22.

setPoints(self, points: Iterable[QgsPointXY])[source]

Configures list of current CAD points

Some map tools may find it useful to override list of CAD points that is otherwise automatically populated when user clicks with left mouse button on map canvas.

Parameters:

points (Iterable[QgsPointXY])

setTool(self, tool: QgsAdvancedDigitizingTool | None)[source]

Sets an advanced digitizing tool which will take over digitizing until the tool is close.

Added in version 3.40.

Parameters:

tool (Optional[QgsAdvancedDigitizingTool])

setX(self, value: str | None, mode: QgsAdvancedDigitizingDockWidget.WidgetSetMode)[source]

Set the X value on the widget. Can be used to set constraints by external widgets.

Parameters:

Note

unstable API (will likely change)

Added in version 3.8.

setY(self, value: str | None, mode: QgsAdvancedDigitizingDockWidget.WidgetSetMode)[source]

Set the Y value on the widget. Can be used to set constraints by external widgets.

Parameters:

Note

unstable API (will likely change)

Added in version 3.8.

setZ(self, value: str | None, mode: QgsAdvancedDigitizingDockWidget.WidgetSetMode)[source]

Set the Z value on the widget. Can be used to set constraints by external widgets.

Parameters:

Note

unstable API (will likely change)

Added in version 3.22.

showConstructionGuides(self) bool[source]

Returns whether the construction guides are visible.

Added in version 3.40.

Return type:

bool

snapToConstructionGuides(self) bool[source]

Returns whether points should snap to construction guides.

Added in version 3.40.

Return type:

bool

snappedSegment(self) List[QgsPointXY]

Snapped to a segment

Return type:

List[QgsPointXY]

snappedToVertex(self) bool[source]

Is it snapped to a vertex

Return type:

bool

signal softLockLineExtensionChanged(locked: bool)[source]

Emitted whenever the soft line extension parameter is locked. Could be used by widgets that must reflect the current advanced digitizing state.

Note

unstable API (will likely change)

Added in version 3.26.

Parameters:

locked (bool)

softLockX(self) float[source]

Returns the X value of the X soft lock. The value is NaN is the constraint isn’t magnetized to a line

Return type:

float

signal softLockXyChanged(locked: bool)[source]

Emitted whenever the soft x/y extension parameter is locked. Could be used by widgets that must reflect the current advanced digitizing state.

Note

unstable API (will likely change)

Added in version 3.26.

Parameters:

locked (bool)

softLockY(self) float[source]

Returns the Y value of the Y soft lock. The value is NaN is the constraint isn’t magnetized to a line

Return type:

float

switchZM(self)[source]

Determines if Z or M will be enabled.

Added in version 3.22.

toggleConstraintDistance(self)[source]

Toggles the distance constraint.

Added in version 3.40.

tool(self) QgsAdvancedDigitizingTool | None[source]

Returns the current advanced digitizing tool. Returns None if not set.

Added in version 3.40.

Return type:

Optional[QgsAdvancedDigitizingTool]

updateCadPaintItem(self)[source]

Updates canvas item that displays constraints on the ma

updateCurrentPoint(self, point: QgsPoint)[source]

Updates the current point in the CAD point list

Added in version 3.30.2.

Parameters:

point (QgsPoint)

signal valueAngleChanged(value: str)[source]

Emitted whenever the angle value changes (either the mouse moved, or the user changed the input). Could be used by widgets that must reflect the current advanced digitizing state.

Note

unstable API (will likely change)

Added in version 3.8.

Parameters:

value (str)

signal valueBearingChanged(value: str)[source]

Emitted whenever the bearing value changes. Could be used by widgets that must reflect the current advanced digitizing state.

Note

unstable API (will likely change)

Added in version 3.32.

Parameters:

value (str)

signal valueCommonAngleSnappingChanged(angle: float)[source]

Emitted whenever the snapping to common angle option changes, angle = 0 means that the functionality is disabled.

Added in version 3.32.

Parameters:

angle (float)

signal valueDistanceChanged(value: str)[source]

Emitted whenever the distance value changes (either the mouse moved, or the user changed the input). Could be used by widgets that must reflect the current advanced digitizing state.

Note

unstable API (will likely change)

Added in version 3.8.

Parameters:

value (str)

signal valueMChanged(value: str)[source]

Emitted whenever the M value changes (either the mouse moved, or the user changed the input). Could be used by widgets that must reflect the current advanced digitizing state.

Note

unstable API (will likely change)

Added in version 3.22.

Parameters:

value (str)

signal valueXChanged(value: str)[source]

Emitted whenever the X value changes (either the mouse moved, or the user changed the input). Could be used by widgets that must reflect the current advanced digitizing state.

Note

unstable API (will likely change)

Added in version 3.8.

Parameters:

value (str)

signal valueYChanged(value: str)[source]

Emitted whenever the Y value changes (either the mouse moved, or the user changed the input). Could be used by widgets that must reflect the current advanced digitizing state.

Note

unstable API (will likely change)

Added in version 3.8.

Parameters:

value (str)

signal valueZChanged(value: str)[source]

Emitted whenever the Z value changes (either the mouse moved, or the user changed the input). Could be used by widgets that must reflect the current advanced digitizing state.

Note

unstable API (will likely change)

Added in version 3.22.

Parameters:

value (str)