Class: QgsMapCanvasTracer

class qgis.gui.QgsMapCanvasTracer

Bases: QgsTracer

Extension of QgsTracer that provides extra functionality:

  • automatic updates of own configuration based on canvas settings

  • reporting of issues to the user via message bar

  • determines whether tracing is currently enabled by the user

A simple registry of tracer instances associated to map canvas instances is kept for convenience. (Map tools do not need to create their local tracer instances and map canvas API is not “polluted” by this optional functionality).

New in version 2.14.

QgsMapCanvasTracer(canvas: QgsMapCanvas, messageBar: QgsMessageBar = None) Create tracer associated with a particular map canvas, optionally message bar for reporting

Methods

actionEnableSnapping

Access to action that user may use to toggle snapping on/off.

actionEnableTracing

Access to action that user may use to toggle tracing on/off.

childEvent

configure

Sets configuration from current snapping settings and canvas settings

connectNotify

customEvent

disconnectNotify

invalidateGraph

Destroy the existing graph structure if any (de-initialize)

isSignalConnected

receivers

reportError

Report a path finding error to the user

sender

senderSignalIndex

setActionEnableSnapping

Assign “enable snapping” checkable action to the tracer.

setActionEnableTracing

Assign “enable tracing” checkable action to the tracer.

timerEvent

tracerForCanvas

Retrieve instance of this class associated with given canvas (if any).

actionEnableSnapping(self)QAction

Access to action that user may use to toggle snapping on/off. May be None if no action was associated.

New in version 3.0.

Return type

QAction

actionEnableTracing(self)QAction

Access to action that user may use to toggle tracing on/off. May be None if no action was associated

Return type

QAction

childEvent(self, QChildEvent)
configure(self)

Sets configuration from current snapping settings and canvas settings

connectNotify(self, QMetaMethod)
customEvent(self, QEvent)
disconnectNotify(self, QMetaMethod)
invalidateGraph(self)

Destroy the existing graph structure if any (de-initialize)

isSignalConnected(self, QMetaMethod)bool
receivers(self, PYQT_SIGNAL)int
reportError(self, err: QgsTracer.PathError, addingVertex: bool)

Report a path finding error to the user

Parameters
sender(self)QObject
senderSignalIndex(self)int
setActionEnableSnapping(self, action: QAction)

Assign “enable snapping” checkable action to the tracer. The action is used to determine whether snapping is currently enabled by the user.

New in version 3.0.

Parameters

action (QAction) –

setActionEnableTracing(self, action: QAction)

Assign “enable tracing” checkable action to the tracer. The action is used to determine whether tracing is currently enabled by the user

Parameters

action (QAction) –

timerEvent(self, QTimerEvent)
tracerForCanvas(canvas: QgsMapCanvas)QgsMapCanvasTracer

Retrieve instance of this class associated with given canvas (if any). The class keeps a simple registry of tracers associated with map canvas instances for easier access to the common tracer by various map tools

Parameters

canvas (QgsMapCanvas) –

Return type

QgsMapCanvasTracer