QGIS API Documentation  3.24.2-Tisler (13c1a02865)
Public Member Functions | List of all members
QgsDefaultVectorLayerLegend Class Reference

Default legend implementation for vector layers. More...

#include <qgsmaplayerlegend.h>

Inheritance diagram for QgsDefaultVectorLayerLegend:
Inheritance graph
[legend]

Public Member Functions

 QgsDefaultVectorLayerLegend (QgsVectorLayer *vl)
 
QList< QgsLayerTreeModelLegendNode * > createLayerTreeModelLegendNodes (QgsLayerTreeLayer *nodeLayer) override
 Returns list of legend nodes to be used for a particular layer tree layer node. More...
 
void readXml (const QDomElement &elem, const QgsReadWriteContext &context) override
 Reads configuration from a DOM element previously written by writeXml() More...
 
void setShowLabelLegend (bool enabled)
 Sets if a legend for the labeling should be shown. More...
 
void setTextOnSymbolContent (const QHash< QString, QString > &content)
 Sets per-symbol content of labels for "text on symbol" functionality. More...
 
void setTextOnSymbolEnabled (bool enabled)
 Sets whether the "text on symbol" functionality is enabled. More...
 
void setTextOnSymbolTextFormat (const QgsTextFormat &format)
 Sets text format of symbol labels for "text on symbol" functionality. More...
 
bool showLabelLegend () const
 Returns whether the legend for the labeling is shown. More...
 
QHash< QString, QString > textOnSymbolContent () const
 Returns per-symbol content of labels for "text on symbol" functionality. More...
 
bool textOnSymbolEnabled () const
 Returns whether the "text on symbol" functionality is enabled. More...
 
QgsTextFormat textOnSymbolTextFormat () const
 Returns text format of symbol labels for "text on symbol" functionality. More...
 
QDomElement writeXml (QDomDocument &doc, const QgsReadWriteContext &context) const override
 Writes configuration to a DOM element, to be used later with readXml() More...
 
- Public Member Functions inherited from QgsMapLayerLegend
 QgsMapLayerLegend (QObject *parent=nullptr)
 Constructor for QgsMapLayerLegend. More...
 

Additional Inherited Members

- Signals inherited from QgsMapLayerLegend
void itemsChanged ()
 Emitted when existing items/nodes got invalid and should be replaced by new ones. More...
 
- Static Public Member Functions inherited from QgsMapLayerLegend
static QgsMapLayerLegenddefaultMeshLegend (QgsMeshLayer *ml)
 Create new legend implementation for mesh layer. More...
 
static QgsMapLayerLegenddefaultPointCloudLegend (QgsPointCloudLayer *layer)
 Create new legend implementation for a point cloud layer. More...
 
static QgsMapLayerLegenddefaultRasterLegend (QgsRasterLayer *rl)
 Create new legend implementation for raster layer. More...
 
static QgsMapLayerLegenddefaultVectorLegend (QgsVectorLayer *vl)
 Create new legend implementation for vector layer. More...
 

Detailed Description

Default legend implementation for vector layers.

Since
QGIS 2.6

Definition at line 236 of file qgsmaplayerlegend.h.

Constructor & Destructor Documentation

◆ QgsDefaultVectorLayerLegend()

QgsDefaultVectorLayerLegend::QgsDefaultVectorLayerLegend ( QgsVectorLayer vl)
explicit

Definition at line 352 of file qgsmaplayerlegend.cpp.

Member Function Documentation

◆ createLayerTreeModelLegendNodes()

QList< QgsLayerTreeModelLegendNode * > QgsDefaultVectorLayerLegend::createLayerTreeModelLegendNodes ( QgsLayerTreeLayer nodeLayer)
overridevirtual

Returns list of legend nodes to be used for a particular layer tree layer node.

Ownership is transferred to the caller.

Implements QgsMapLayerLegend.

Definition at line 359 of file qgsmaplayerlegend.cpp.

◆ readXml()

void QgsDefaultVectorLayerLegend::readXml ( const QDomElement &  elem,
const QgsReadWriteContext context 
)
overridevirtual

Reads configuration from a DOM element previously written by writeXml()

Since
QGIS 3.2

Reimplemented from QgsMapLayerLegend.

Definition at line 448 of file qgsmaplayerlegend.cpp.

◆ setShowLabelLegend()

void QgsDefaultVectorLayerLegend::setShowLabelLegend ( bool  enabled)
inline

Sets if a legend for the labeling should be shown.

Parameters
enabledtrue to show label legend entries
Since
QGIS 3.20

Definition at line 270 of file qgsmaplayerlegend.h.

◆ setTextOnSymbolContent()

void QgsDefaultVectorLayerLegend::setTextOnSymbolContent ( const QHash< QString, QString > &  content)
inline

Sets per-symbol content of labels for "text on symbol" functionality.

In the passed dictionary the keys are rule keys of legend items, the values are labels to be shown.

Since
QGIS 3.2

Definition at line 296 of file qgsmaplayerlegend.h.

◆ setTextOnSymbolEnabled()

void QgsDefaultVectorLayerLegend::setTextOnSymbolEnabled ( bool  enabled)
inline

Sets whether the "text on symbol" functionality is enabled.

When enabled, legend symbols may have extra text rendered on top. The content of labels and their style is controlled by textOnSymbolContent() and textOnSymbolTextFormat().

Since
QGIS 3.2

Definition at line 257 of file qgsmaplayerlegend.h.

◆ setTextOnSymbolTextFormat()

void QgsDefaultVectorLayerLegend::setTextOnSymbolTextFormat ( const QgsTextFormat format)
inline

Sets text format of symbol labels for "text on symbol" functionality.

Since
QGIS 3.2

Definition at line 282 of file qgsmaplayerlegend.h.

◆ showLabelLegend()

bool QgsDefaultVectorLayerLegend::showLabelLegend ( ) const
inline

Returns whether the legend for the labeling is shown.

Since
QGIS 3.20

Definition at line 263 of file qgsmaplayerlegend.h.

◆ textOnSymbolContent()

QHash<QString, QString> QgsDefaultVectorLayerLegend::textOnSymbolContent ( ) const
inline

Returns per-symbol content of labels for "text on symbol" functionality.

In the passed dictionary the keys are rule keys of legend items, the values are labels to be shown.

Since
QGIS 3.2

Definition at line 289 of file qgsmaplayerlegend.h.

◆ textOnSymbolEnabled()

bool QgsDefaultVectorLayerLegend::textOnSymbolEnabled ( ) const
inline

Returns whether the "text on symbol" functionality is enabled.

When enabled, legend symbols may have extra text rendered on top. The content of labels and their style is controlled by textOnSymbolContent() and textOnSymbolTextFormat().

Since
QGIS 3.2

Definition at line 249 of file qgsmaplayerlegend.h.

◆ textOnSymbolTextFormat()

QgsTextFormat QgsDefaultVectorLayerLegend::textOnSymbolTextFormat ( ) const
inline

Returns text format of symbol labels for "text on symbol" functionality.

Since
QGIS 3.2

Definition at line 276 of file qgsmaplayerlegend.h.

◆ writeXml()

QDomElement QgsDefaultVectorLayerLegend::writeXml ( QDomDocument &  doc,
const QgsReadWriteContext context 
) const
overridevirtual

Writes configuration to a DOM element, to be used later with readXml()

Since
QGIS 3.2

Reimplemented from QgsMapLayerLegend.

Definition at line 472 of file qgsmaplayerlegend.cpp.


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