Class: QgsRendererAbstractMetadata¶
Stores metadata about one renderer class.
Note
It’s necessary to implement createRenderer() function.
In C++ you can use QgsRendererMetadata convenience class.
Class Hierarchy¶
Subclasses¶
Convenience metadata class that uses static functions to create renderer and its widget. |
Methods
Returns flags indicating the types of layer the renderer is compatible with. |
|
Returns new instance of the renderer given the DOM element. |
|
Returns a new instance of the renderer, converted from an SLD XML element. |
|
Returns new instance of settings widget for the renderer. |
|
Returns an icon representing the renderer. |
|
Returns the unique name of the renderer. |
|
Sets an icon representing the renderer. |
|
Returns a friendly display name of the renderer. |
Attributes
- class qgis.core.QgsRendererAbstractMetadata[source]¶
Bases:
object- __init__(name: str | None, visibleName: str | None, icon: QIcon = QIcon())
Constructor for QgsRendererAbstractMetadata, with the specified
name.The
visibleNameargument gives a translated, user friendly string identifying the renderer type.The
iconargument can be used to specify an icon representing the renderer.- Parameters:
name (Optional[str])
visibleName (Optional[str])
icon (QIcon = QIcon())
- __init__(a0: QgsRendererAbstractMetadata)
- Parameters:
- All = 7¶
- class LayerType¶
Bases:
int
- class LayerTypes¶
- class LayerTypes(f: QgsRendererAbstractMetadata.LayerTypes | QgsRendererAbstractMetadata.LayerType)
- class LayerTypes(a0: QgsRendererAbstractMetadata.LayerTypes)
Bases:
object
- LineLayer = 2¶
- PointLayer = 1¶
- PolygonLayer = 4¶
- compatibleLayerTypes(self) QgsRendererAbstractMetadata.LayerTypes[source]¶
Returns flags indicating the types of layer the renderer is compatible with.
- Return type:
- createRenderer(self, elem: QDomElement, context: QgsReadWriteContext) QgsFeatureRenderer | None[source]¶
Returns new instance of the renderer given the DOM element. Returns
Noneon error. Pure virtual function: must be implemented in derived classes.- Parameters:
elem (QDomElement)
context (QgsReadWriteContext)
- Return type:
Optional[QgsFeatureRenderer]
- createRendererFromSld(self, elem: QDomElement, geomType: Qgis.GeometryType) QgsFeatureRenderer | None[source]¶
Returns a new instance of the renderer, converted from an SLD XML element.
- Parameters:
elem (QDomElement)
geomType (Qgis.GeometryType)
- Return type:
Optional[QgsFeatureRenderer]
- createRendererWidget(self, layer: QgsVectorLayer | None, style: QgsStyle | None, oldRenderer: QgsFeatureRenderer | None) QgsRendererWidget | None[source]¶
Returns new instance of settings widget for the renderer. Returns
Noneon error.The
oldRendererargument may refer to previously used renderer (or it isNone). If notNone, it may be used to initialize GUI of the widget from the previous settings. The old renderer does not have to be of the same type as returned bycreateRenderer().- Parameters:
layer (Optional[QgsVectorLayer])
style (Optional[QgsStyle])
oldRenderer (Optional[QgsFeatureRenderer])
- Return type:
Optional[QgsRendererWidget]
- name(self) str[source]¶
Returns the unique name of the renderer. This value is not translated.
See also
- Return type:
str