QGIS API Documentation 3.40.0-Bratislava (b56115d8743)
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Attributes | List of all members
QgsRendererAbstractMetadata Class Referenceabstract

Stores metadata about one renderer class. More...

#include <qgsrendererregistry.h>

Inheritance diagram for QgsRendererAbstractMetadata:
Inheritance graph
[legend]

Public Types

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

Public Member Functions

 QgsRendererAbstractMetadata (const QString &name, const QString &visibleName, const QIcon &icon=QIcon())
 Constructor for QgsRendererAbstractMetadata, with the specified name.
 
virtual ~QgsRendererAbstractMetadata ()=default
 
virtual QgsRendererAbstractMetadata::LayerTypes compatibleLayerTypes () const
 Returns flags indicating the types of layer the renderer is compatible with.
 
virtual QgsFeatureRenderercreateRenderer (QDomElement &elem, const QgsReadWriteContext &context)=0
 Returns new instance of the renderer given the DOM element.
 
virtual QgsFeatureRenderercreateRendererFromSld (QDomElement &elem, Qgis::GeometryType geomType)
 Returns a new instance of the renderer, converted from an SLD XML element.
 
virtual QgsRendererWidgetcreateRendererWidget (QgsVectorLayer *layer, QgsStyle *style, QgsFeatureRenderer *oldRenderer)
 Returns new instance of settings widget for the renderer.
 
QIcon icon () const
 Returns an icon representing the renderer.
 
QString name () const
 Returns the unique name of the renderer.
 
void setIcon (const QIcon &icon)
 Sets an icon representing the renderer.
 
QString visibleName () const
 Returns a friendly display name of the renderer.
 

Protected Attributes

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)
 

Detailed Description

Stores metadata about one renderer class.

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

Definition at line 41 of file qgsrendererregistry.h.

Member Typedef Documentation

◆ LayerTypes

Definition at line 55 of file qgsrendererregistry.h.

Member Enumeration Documentation

◆ LayerType

Layer types the renderer is compatible with.

Enumerator
PointLayer 

Compatible with point layers.

LineLayer 

Compatible with line layers.

PolygonLayer 

Compatible with polygon layers.

All 

Compatible with all vector layers.

Definition at line 48 of file qgsrendererregistry.h.

Constructor & Destructor Documentation

◆ QgsRendererAbstractMetadata()

QgsRendererAbstractMetadata::QgsRendererAbstractMetadata ( const QString &  name,
const QString &  visibleName,
const QIcon &  icon = QIcon() 
)
inline

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.

Definition at line 64 of file qgsrendererregistry.h.

◆ ~QgsRendererAbstractMetadata()

virtual QgsRendererAbstractMetadata::~QgsRendererAbstractMetadata ( )
virtualdefault

Member Function Documentation

◆ compatibleLayerTypes()

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

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

Reimplemented in QgsRendererMetadata.

Definition at line 98 of file qgsrendererregistry.h.

◆ createRenderer()

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

Returns new instance of the renderer given the DOM element.

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

Implemented in QgsRendererMetadata.

◆ createRendererFromSld()

virtual QgsFeatureRenderer * QgsRendererAbstractMetadata::createRendererFromSld ( QDomElement &  elem,
Qgis::GeometryType  geomType 
)
inlinevirtual

Returns a new instance of the renderer, converted from an SLD XML element.

Reimplemented in QgsRendererMetadata.

Definition at line 119 of file qgsrendererregistry.h.

◆ createRendererWidget()

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

Returns new instance of settings widget for the renderer.

Returns nullptr on error.

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

Reimplemented in QgsRendererMetadata.

Definition at line 113 of file qgsrendererregistry.h.

◆ icon()

QIcon QgsRendererAbstractMetadata::icon ( ) const
inline

Returns an icon representing the renderer.

See also
setIcon()

Definition at line 87 of file qgsrendererregistry.h.

◆ name()

QString QgsRendererAbstractMetadata::name ( ) const
inline

Returns the unique name of the renderer.

This value is not translated.

See also
visibleName()

Definition at line 75 of file qgsrendererregistry.h.

◆ setIcon()

void QgsRendererAbstractMetadata::setIcon ( const QIcon &  icon)
inline

Sets an icon representing the renderer.

See also
icon()

Definition at line 93 of file qgsrendererregistry.h.

◆ visibleName()

QString QgsRendererAbstractMetadata::visibleName ( ) const
inline

Returns a friendly display name of the renderer.

This value is translated.

See also
name()

Definition at line 81 of file qgsrendererregistry.h.

Member Data Documentation

◆ mIcon

QIcon QgsRendererAbstractMetadata::mIcon
protected

icon to be shown in the renderer properties dialog

Definition at line 128 of file qgsrendererregistry.h.

◆ mName

QString QgsRendererAbstractMetadata::mName
protected

name used within QGIS for identification (the same what renderer's type() returns)

Definition at line 124 of file qgsrendererregistry.h.

◆ mVisibleName

QString QgsRendererAbstractMetadata::mVisibleName
protected

name visible for users (translatable)

Definition at line 126 of file qgsrendererregistry.h.


The documentation for this class was generated from the following file: