Class: QgsCreateAnnotationItemMapToolHandler

class qgis.gui.QgsCreateAnnotationItemMapToolHandler

Bases: PyQt5.QtCore.QObject

A handler object for map tools which create annotation items.

This object is designed to be used by map tools which implement the QgsCreateAnnotationItemMapToolInterface, following the composition pattern.

Clients should connect to the handler’s itemCreated() signal, and call the takeCreatedItem() implementation to take ownership of the newly created item whenever this signal is emitted.

New in version 3.22.

QgsCreateAnnotationItemMapToolHandler(canvas: QgsMapCanvas, cadDockWidget: QgsAdvancedDigitizingDockWidget, parent: QObject = None) Constructor for QgsCreateAnnotationItemMapToolHandler, with the specified parent object.

Methods

childEvent

connectNotify

customEvent

disconnectNotify

isSignalConnected

pushCreatedItem

Pushes a created item to the handler.

receivers

sender

senderSignalIndex

takeCreatedItem

Takes the newly created item from the tool, transferring ownership to the caller.

targetLayer

Returns the target layer for newly created items.

timerEvent

Signals

itemCreated

Emitted by the tool when a new annotation item has been created.

childEvent(self, QChildEvent)
connectNotify(self, QMetaMethod)
customEvent(self, QEvent)
disconnectNotify(self, QMetaMethod)
isSignalConnected(self, QMetaMethod) bool
itemCreated

Emitted by the tool when a new annotation item has been created.

Clients should connect to this signal and call takeCreatedItem() to take the newly created item from the map tool. [signal]

pushCreatedItem(self, item: QgsAnnotationItem)

Pushes a created item to the handler.

Ownership of item is transferred to the handler.

Calling this method causes the object to emit the itemCreated() signal, and queue the item ready for collection via a call to takeCreatedItem().

Parameters

item (QgsAnnotationItem) –

receivers(self, PYQT_SIGNAL) int
sender(self) QObject
senderSignalIndex(self) int
takeCreatedItem(self) QgsAnnotationItem

Takes the newly created item from the tool, transferring ownership to the caller.

Return type

QgsAnnotationItem

targetLayer(self) QgsAnnotationLayer

Returns the target layer for newly created items.

Return type

QgsAnnotationLayer

timerEvent(self, QTimerEvent)