Class: QgsMapCanvasTracer

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

Bases: qgis._core.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: 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
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).

Signals

Attributes

actionEnableSnapping(self) → QAction

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

New in version 3.0.

actionEnableTracing(self) → QAction

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

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

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.

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

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