Class: QgsAnnotationItemAbstractGuiMetadata¶
- class qgis.gui.QgsAnnotationItemAbstractGuiMetadata¶
Bases:
sip.wrapper
Stores GUI metadata about one annotation item class.
This is a companion to
QgsAnnotationItemAbstractMetadata
, storing only the components related to the GUI behavior of an annotation item.Note
In C++ you can use
QgsAnnotationItemGuiMetadata
convenience class.Added in version 3.22.
QgsAnnotationItemAbstractGuiMetadata(type: Optional[str], visibleName: Optional[str], groupId: Optional[str] = ‘’, flags: Union[Qgis.AnnotationItemGuiFlags, Qgis.AnnotationItemGuiFlag] = Qgis.AnnotationItemGuiFlags()) Constructor for
QgsAnnotationItemAbstractGuiMetadata
with the specified classtype
.visibleName
should be set to a translated, user visible name identifying the corresponding annotation item.An optional
groupId
can be set, which allows grouping of related annotation item classes. SeeQgsAnnotationItemGuiMetadata
for details.QgsAnnotationItemAbstractGuiMetadata(a0:
QgsAnnotationItemAbstractGuiMetadata
)Methods
Creates an instance of the corresponding item type.
Creates a configuration widget for an
item
of this type.Creates a map tool for a creating a new item of this type.
Returns an icon representing creation of the annotation item type.
Returns item flags.
Returns the item group ID, if set.
Called when a newly created item of the associated type has been added to a
layer
.Returns the unique item type code for the annotation item class.
Returns a translated, user visible name identifying the corresponding annotation item.
- createItem(self) QgsAnnotationItem | None ¶
Creates an instance of the corresponding item type.
- Return type:
Optional[QgsAnnotationItem]
- createItemWidget(self, item: QgsAnnotationItem | None) QgsAnnotationItemBaseWidget | None ¶
Creates a configuration widget for an
item
of this type. Can returnNone
if no configuration GUI is required.- Parameters:
item (Optional[QgsAnnotationItem])
- Return type:
Optional[QgsAnnotationItemBaseWidget]
- createMapTool(self, canvas: QgsMapCanvas | None, cadDockWidget: QgsAdvancedDigitizingDockWidget | None) QgsCreateAnnotationItemMapToolInterface | None ¶
Creates a map tool for a creating a new item of this type.
May return
None
if no map tool is available for creating the item.- Parameters:
canvas (Optional[QgsMapCanvas])
cadDockWidget (Optional[QgsAdvancedDigitizingDockWidget])
- Return type:
Optional[QgsCreateAnnotationItemMapToolInterface]
- creationIcon(self) QIcon ¶
Returns an icon representing creation of the annotation item type.
- Return type:
QIcon
- flags(self) Qgis.AnnotationItemGuiFlags ¶
Returns item flags.
- Return type:
- groupId(self) str ¶
Returns the item group ID, if set.
- Return type:
str
- newItemAddedToLayer(self, item: QgsAnnotationItem | None, layer: QgsAnnotationLayer | None)¶
Called when a newly created item of the associated type has been added to a
layer
.This is only called for additions which result from GUI operations - i.e. it is not called for items added programmatically.
- Parameters:
item (Optional[QgsAnnotationItem])
layer (Optional[QgsAnnotationLayer])
- type(self) str ¶
Returns the unique item type code for the annotation item class.
- Return type:
str
- visibleName(self) str ¶
Returns a translated, user visible name identifying the corresponding annotation item.
- Return type:
str