Class: QgsMapCanvasTracer

class qgis.gui.QgsMapCanvasTracer(canvas: QgsMapCanvas, messageBar: QgsMessageBar = None)

Bases: QgsTracer

Create tracer associated with a particular map canvas, optionally message bar for reporting

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.

Parameters
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()
configure(self)

Sets configuration from current snapping settings and canvas settings

connectNotify()
customEvent()
disconnectNotify()
invalidateGraph()
isSignalConnected()
receivers()
reportError(self, err: QgsTracer.PathError, addingVertex: bool)

Report a path finding error to the user

Parameters
sender()
senderSignalIndex()
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()
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