Class: QgsMapLayerLegend

class qgis.core.QgsMapLayerLegend(parent: QObject = None)

Bases: PyQt5.QtCore.QObject

Constructor for QgsMapLayerLegend

The QgsMapLayerLegend class is abstract interface for implementations of legends for one map layer.

New in version 2.6.

Parameters

parent

childEvent(self, QChildEvent)
connectNotify(self, QMetaMethod)
createLayerTreeModelLegendNodes(self, nodeLayer: QgsLayerTreeLayer) → List[QgsLayerTreeModelLegendNode]

Returns list of legend nodes to be used for a particular layer tree layer node. Ownership is transferred to the caller.

Parameters

nodeLayer (QgsLayerTreeLayer) –

Return type

List[QgsLayerTreeModelLegendNode]

customEvent(self, QEvent)
defaultMeshLegend(ml: QgsMeshLayer)QgsMapLayerLegend

Create new legend implementation for mesh layer

Parameters

ml (QgsMeshLayer) –

Return type

QgsMapLayerLegend

defaultPointCloudLegend(layer: QgsPointCloudLayer)QgsMapLayerLegend

Create new legend implementation for a point cloud layer.

New in version 3.18.

Parameters

layer (QgsPointCloudLayer) –

Return type

QgsMapLayerLegend

defaultRasterLegend(rl: QgsRasterLayer)QgsMapLayerLegend

Create new legend implementation for raster layer

Parameters

rl (QgsRasterLayer) –

Return type

QgsMapLayerLegend

defaultVectorLegend(vl: QgsVectorLayer)QgsMapLayerLegend

Create new legend implementation for vector layer

Parameters

vl (QgsVectorLayer) –

Return type

QgsMapLayerLegend

disconnectNotify(self, QMetaMethod)
isSignalConnected(self, QMetaMethod) → bool
itemsChanged

Emitted when existing items/nodes got invalid and should be replaced by new ones [signal]

readXml(self, elem: QDomElement, context: QgsReadWriteContext)

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

New in version 3.2.

Parameters
receivers(self, PYQT_SIGNAL) → int
sender(self) → QObject
senderSignalIndex(self) → int
timerEvent(self, QTimerEvent)
writeXml(self, doc: QDomDocument, context: QgsReadWriteContext) → QDomElement

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

New in version 3.2.

Parameters
Return type

QDomElement