QgsRendererAbstractMetadata class

Stores metadata about one renderer class.

Derived classes

class QgsRendererMetadata
Convenience metadata class that uses static functions to create renderer and its widget.

Public types

enum LayerType { PointLayer = 1, LineLayer = 2, PolygonLayer = 4, All = PointLayer | LineLayer | PolygonLayer }
Layer types the renderer is compatible with.

Public functions

auto compatibleLayerTypes() const -> QgsRendererAbstractMetadata::LayerTypes virtual
Returns flags indicating the types of layer the renderer is compatible with.
auto createRenderer(QDomElement& elem, const QgsReadWriteContext& context) -> QgsFeatureRenderer* pure virtual
Returns new instance of the renderer given the DOM element.
auto createRendererWidget(QgsVectorLayer* layer, QgsStyle* style, QgsFeatureRenderer* oldRenderer) -> QgsRendererWidget* virtual
Returns new instance of settings widget for the renderer.

Protected variables

QIcon mIcon
icon to be shown in the renderer properties dialog
QString mName
name used within QGIS for identification (the same what renderer's type() returns)
QString mVisibleName
name visible for users (translatable)

Enum documentation

enum QgsRendererAbstractMetadata::LayerType

Layer types the renderer is compatible with.

Enumerators
PointLayer

Compatible with point layers.

LineLayer

Compatible with line layers.

PolygonLayer

Compatible with polygon layers.

All

Compatible with all vector layers.

Function documentation

QgsRendererAbstractMetadata::LayerTypes QgsRendererAbstractMetadata::compatibleLayerTypes() const virtual

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

QgsFeatureRenderer* QgsRendererAbstractMetadata::createRenderer(QDomElement& elem, const QgsReadWriteContext& context) pure virtual

Returns new instance of the renderer given the DOM element.

Returns NULL on error. Pure virtual function: must be implemented in derived classes.

QgsRendererWidget* QgsRendererAbstractMetadata::createRendererWidget(QgsVectorLayer* layer, QgsStyle* style, QgsFeatureRenderer* oldRenderer) virtual

Returns new instance of settings widget for the renderer.

Returns NULL on error.

The oldRenderer argument may refer to previously used renderer (or it is null). If not null, 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(). When using oldRenderer make sure to make a copy of it - it will be deleted afterwards.