Class: QgsAnnotationItemBaseWidget¶
A base class for property widgets for annotation items.
All annotation item widgets should inherit from this base class.
Added in version 3.22.
Note
This is an abstract class, with methods which must be implemented by a subclass.
The following methods must be implemented: createItem(), updateItem()
Class Hierarchy¶
Base classes¶
Base class for any widget that can be shown as an inline panel. |
|
- class qgis.gui.QgsAnnotationItemBaseWidget[source]¶
Bases:
QgsPanelWidget- __init__(parent: QWidget | None)
Constructor for QgsAnnotationItemBaseWidget.
- Parameters:
parent (Optional[QWidget])
- context(self) QgsSymbolWidgetContext[source]¶
Returns the context in which the widget is shown, e.g., the associated map canvas and expression contexts.
See also
- Return type:
- abstract createItem(self) QgsAnnotationItem | None[source]¶
Creates a new item matching the settings defined in the widget.
- Return type:
Optional[QgsAnnotationItem]
- signal itemChanged[source]¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- itemId(self) str[source]¶
Returns the associated annotation item id.
See also
Added in version 3.40.
- Return type:
str
- layer(self) QgsAnnotationLayer | None[source]¶
Returns the associated annotation map layer.
See also
Added in version 3.40.
- Return type:
Optional[QgsAnnotationLayer]
- renderedItemDetails(self) QgsRenderedAnnotationItemDetails | None[source]¶
Retrieve rendered annotation details for the associated annotation, if available.
Added in version 3.40.
- Return type:
Optional[QgsRenderedAnnotationItemDetails]
- virtual setContext(self, context: QgsSymbolWidgetContext)[source]¶
Sets the
contextin which the widget is shown, e.g., the associated map canvas and expression contexts.See also
- Parameters:
context (QgsSymbolWidgetContext)
- setItem(self, item: QgsAnnotationItem | None) bool[source]¶
Sets the current
itemto show in the widget. IfTrueis returned,itemwas an acceptable type for display in this widget and the widget has been updated to matchitem’s properties.If
Falseis returned, then the widget could not be successfully updated to show the properties ofitem.- Parameters:
item (Optional[QgsAnnotationItem])
- Return type:
bool
- setItemId(self, id: str | None)[source]¶
Sets the associated annotation item
id.See also
Added in version 3.40.
- Parameters:
id (Optional[str])
- virtual setLayer(self, layer: QgsAnnotationLayer | None)[source]¶
Sets the associated annotation map
layer.See also
Added in version 3.40.
- Parameters:
layer (Optional[QgsAnnotationLayer])
- virtual setNewItem(self, item: QgsAnnotationItem | None) bool[source]¶
Attempts to update the widget to show the properties for the specified
item.Subclasses can override this if they support changing items in place.
Implementations must return
Trueif the item was accepted and the widget was updated.- Parameters:
item (Optional[QgsAnnotationItem])
- Return type:
bool
- abstract updateItem(self, item: QgsAnnotationItem | None)[source]¶
Updates an existing item to match the settings defined in the widget.
- Parameters:
item (Optional[QgsAnnotationItem])