Class: QgsRendererAbstractMetadata

class qgis.core.QgsRendererAbstractMetadata(name: str, visibleName: str, icon: QIcon = QIcon())

Bases: sip.wrapper

Constructor for QgsRendererAbstractMetadata, with the specified name.

The visibleName argument gives a translated, user friendly string identifying the renderer type.

The icon argument can be used to specify an icon representing the renderer.

QgsRendererAbstractMetadata(QgsRendererAbstractMetadata)

Stores metadata about one renderer class.

Note

It’s necessary to implement createRenderer() function. In C++ you can use QgsRendererMetadata convenience class.

Parameters
  • name (str) –

  • visibleName (str) –

  • icon

All = 7
class LayerType

Bases: int

class LayerTypes

Bases: sip.wrapper

QgsRendererAbstractMetadata.LayerTypes(Union[QgsRendererAbstractMetadata.LayerTypes, QgsRendererAbstractMetadata.LayerType]) QgsRendererAbstractMetadata.LayerTypes(QgsRendererAbstractMetadata.LayerTypes)

LineLayer = 2
PointLayer = 1
PolygonLayer = 4
compatibleLayerTypes(self) → QgsRendererAbstractMetadata.LayerTypes

Returns flags indicating the types of layer the renderer is compatible with.

New in version 2.16.

Return type

QgsRendererAbstractMetadata.LayerTypes

createRenderer(self, elem: QDomElement, context: QgsReadWriteContext) → QgsFeatureRenderer

Returns new instance of the renderer given the DOM element. Returns None on error. Pure virtual function: must be implemented in derived classes. *

Parameters
Return type

QgsFeatureRenderer

createRendererFromSld(self, elem: QDomElement, geomType: QgsWkbTypes.GeometryType) → QgsFeatureRenderer
Parameters
Return type

QgsFeatureRenderer

createRendererWidget(self, layer: QgsVectorLayer, style: QgsStyle, oldRenderer: QgsFeatureRenderer) → QgsRendererWidget

Returns new instance of settings widget for the renderer. Returns None on error.

The oldRenderer argument may refer to previously used renderer (or it is None). If not None, 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 by createRenderer().

Parameters
Return type

QgsRendererWidget

icon(self) → QIcon

Returns an icon representing the renderer.

See also

setIcon()

Return type

QIcon

name(self) → str

Returns the unique name of the renderer. This value is not translated.

See also

visibleName()

Return type

str

setIcon(self, icon: QIcon)

Sets an icon representing the renderer.

See also

icon()

Parameters

icon (QIcon) –

visibleName(self) → str

Returns a friendly display name of the renderer. This value is translated.

See also

name()

Return type

str