Class: QgsCreateAnnotationItemMapToolHandler¶
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.
Added in version 3.22.
Class Hierarchy¶
Base classes¶
Methods
Pushes a created item to the handler. |
|
Takes the newly created item from the tool, transferring ownership to the caller. |
|
Returns the target layer for newly created items. |
Signals
Emitted by the tool when a new annotation item has been created. |
- class qgis.gui.QgsCreateAnnotationItemMapToolHandler[source]¶
Bases:
QObject
- __init__(canvas: QgsMapCanvas | None, cadDockWidget: QgsAdvancedDigitizingDockWidget | None, parent: QObject | None = None)
Constructor for QgsCreateAnnotationItemMapToolHandler, with the specified
parent
object.- Parameters:
canvas (Optional[QgsMapCanvas])
cadDockWidget (Optional[QgsAdvancedDigitizingDockWidget])
parent (Optional[QObject] = None)
- signal itemCreated[source]¶
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.
- pushCreatedItem(self, item: QgsAnnotationItem | None)[source]¶
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 totakeCreatedItem()
.- Parameters:
item (Optional[QgsAnnotationItem])
- takeCreatedItem(self) QgsAnnotationItem | None [source]¶
Takes the newly created item from the tool, transferring ownership to the caller.
- Return type:
Optional[QgsAnnotationItem]
- targetLayer(self) QgsAnnotationLayer | None [source]¶
Returns the target layer for newly created items.
- Return type:
Optional[QgsAnnotationLayer]