QGIS API Documentation 3.99.0-Master (21b3aa880ba)
Loading...
Searching...
No Matches
QgsMapLayerLegend Class Referenceabstract

An abstract interface for implementations of legends for one map layer. More...

#include <qgsmaplayerlegend.h>

Inheritance diagram for QgsMapLayerLegend:

Signals

void itemsChanged ()
 Emitted when existing items/nodes got invalid and should be replaced by new ones.

Public Member Functions

 QgsMapLayerLegend (QObject *parent=nullptr)
 Constructor for QgsMapLayerLegend.
virtual QList< QgsLayerTreeModelLegendNode * > createLayerTreeModelLegendNodes (QgsLayerTreeLayer *nodeLayer)=0
 Returns list of legend nodes to be used for a particular layer tree layer node.
Qgis::MapLayerLegendFlags flags () const
 Returns flags associated with the legend.
virtual void readXml (const QDomElement &elem, const QgsReadWriteContext &context)
 Reads configuration from a DOM element previously written by writeXml().
void setFlag (Qgis::MapLayerLegendFlag flag, bool on=true)
 Enables or disables a particular flag (other flags are not affected).
void setFlags (Qgis::MapLayerLegendFlags flags)
 Sets the flags associated with the legend.
virtual QDomElement writeXml (QDomDocument &doc, const QgsReadWriteContext &context) const
 Writes configuration to a DOM element, to be used later with readXml().

Static Public Member Functions

static QgsMapLayerLegenddefaultMeshLegend (QgsMeshLayer *ml)
 Create new legend implementation for mesh layer.
static QgsMapLayerLegenddefaultPointCloudLegend (QgsPointCloudLayer *layer)
 Create new legend implementation for a point cloud layer.
static QgsMapLayerLegenddefaultRasterLegend (QgsRasterLayer *rl)
 Create new legend implementation for raster layer.
static QgsMapLayerLegenddefaultVectorLegend (QgsVectorLayer *vl)
 Create new legend implementation for vector layer.

Detailed Description

An abstract interface for implementations of legends for one map layer.

Definition at line 49 of file qgsmaplayerlegend.h.

Constructor & Destructor Documentation

◆ QgsMapLayerLegend()

QgsMapLayerLegend::QgsMapLayerLegend ( QObject * parent = nullptr)
explicit

Constructor for QgsMapLayerLegend.

Definition at line 39 of file qgsmaplayerlegend.cpp.

Member Function Documentation

◆ createLayerTreeModelLegendNodes()

virtual QList< QgsLayerTreeModelLegendNode * > QgsMapLayerLegend::createLayerTreeModelLegendNodes ( QgsLayerTreeLayer * nodeLayer)
pure virtual

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

Ownership is transferred to the caller.

Implemented in QgsDefaultMeshLayerLegend, QgsDefaultPointCloudLayerLegend, QgsDefaultRasterLayerLegend, and QgsDefaultVectorLayerLegend.

◆ defaultMeshLegend()

QgsMapLayerLegend * QgsMapLayerLegend::defaultMeshLegend ( QgsMeshLayer * ml)
static

Create new legend implementation for mesh layer.

Definition at line 70 of file qgsmaplayerlegend.cpp.

◆ defaultPointCloudLegend()

QgsMapLayerLegend * QgsMapLayerLegend::defaultPointCloudLegend ( QgsPointCloudLayer * layer)
static

Create new legend implementation for a point cloud layer.

Since
QGIS 3.18

Definition at line 75 of file qgsmaplayerlegend.cpp.

◆ defaultRasterLegend()

QgsMapLayerLegend * QgsMapLayerLegend::defaultRasterLegend ( QgsRasterLayer * rl)
static

Create new legend implementation for raster layer.

Definition at line 65 of file qgsmaplayerlegend.cpp.

◆ defaultVectorLegend()

QgsMapLayerLegend * QgsMapLayerLegend::defaultVectorLegend ( QgsVectorLayer * vl)
static

Create new legend implementation for vector layer.

Definition at line 60 of file qgsmaplayerlegend.cpp.

◆ flags()

Qgis::MapLayerLegendFlags QgsMapLayerLegend::flags ( ) const
inline

Returns flags associated with the legend.

See also
setFlag()
setFlags()
Since
QGIS 4.0

Definition at line 66 of file qgsmaplayerlegend.h.

◆ itemsChanged

void QgsMapLayerLegend::itemsChanged ( )
signal

Emitted when existing items/nodes got invalid and should be replaced by new ones.

◆ readXml()

void QgsMapLayerLegend::readXml ( const QDomElement & elem,
const QgsReadWriteContext & context )
virtual

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

Since
QGIS 3.2

Reimplemented in QgsDefaultVectorLayerLegend.

Definition at line 44 of file qgsmaplayerlegend.cpp.

◆ setFlag()

void QgsMapLayerLegend::setFlag ( Qgis::MapLayerLegendFlag flag,
bool on = true )
inline

Enables or disables a particular flag (other flags are not affected).

See also
flags()
setFlags()
Since
QGIS 4.0

Definition at line 75 of file qgsmaplayerlegend.h.

◆ setFlags()

void QgsMapLayerLegend::setFlags ( Qgis::MapLayerLegendFlags flags)
inline

Sets the flags associated with the legend.

See also
setFlag()
flags()
Since
QGIS 4.0

Definition at line 84 of file qgsmaplayerlegend.h.

◆ writeXml()

QDomElement QgsMapLayerLegend::writeXml ( QDomDocument & doc,
const QgsReadWriteContext & context ) const
virtual

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

Since
QGIS 3.2

Reimplemented in QgsDefaultVectorLayerLegend.

Definition at line 50 of file qgsmaplayerlegend.cpp.


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