Class: QgsLegendModel

class qgis.core.QgsLegendModel(rootNode: QgsLayerTree, parent: QObject = None, layout: QgsLayoutItemLegend = None)

Bases: QgsLayerTreeModel

Construct the model based on the given layer tree

QgsLegendModel(rootNode: QgsLayerTree, layout: QgsLayoutItemLegend) Alternative constructor.

Item model implementation based on layer tree model for layout legend.

Overrides some functionality of QgsLayerTreeModel to better fit the needs of layout legends.

New in version 2.6.

Parameters
  • rootNode (QgsLayerTree) –

  • parent (QObject = None) –

  • layout

addLegendToLayer()
beginInsertColumns()
beginInsertRows()
beginMoveColumns()
beginMoveRows()
beginRemoveColumns()
beginRemoveRows()
beginResetModel()
changePersistentIndex()
changePersistentIndexList()
childEvent()
connectNotify()
connectToLayer()
connectToLayers()
connectToRootNode()
createIndex()
customEvent()
data(self, index: QModelIndex, role: int) → Any
Parameters
  • index (QModelIndex) –

  • role (int) –

Return type

Any

decodeData()
disconnectFromLayer()
disconnectFromLayers()
disconnectFromRootNode()
disconnectNotify()
encodeData()
endInsertColumns()
endInsertRows()
endMoveColumns()
endMoveRows()
endRemoveColumns()
endRemoveRows()
endResetModel()
filterLegendNodes()
flags(self, index: QModelIndex) → Qt.ItemFlags
Parameters

index (QModelIndex) –

Return type

Qt.ItemFlags

iconGroup()
indexOfParentLayerTreeNode()
invalidateLegendMapBasedData()
isSignalConnected()
layerLegendChanged()
layerNeedsUpdate()
legendCleanup()
legendEmbeddedInParent()
legendIconEmbeddedInParent()
legendInvalidateMapBasedData()
legendNodeData()
legendNodeDataChanged()
legendNodeFlags()
legendNodeIndex()
legendNodeRowCount()
legendParent()
legendRootIndex()
legendRootRowCount()
nodeAddedChildren()
nodeCustomPropertyChanged()
nodeLayerLoaded()
nodeLayerWillBeUnloaded()
nodeNameChanged()
nodeRemovedChildren()
nodeVisibilityChanged()
nodeWillAddChildren()
nodeWillRemoveChildren()
persistentIndexList()
receivers()
recursivelyEmitDataChanged()
refreshLegend

Emitted to refresh the legend.

New in version 3.10: [signal]

refreshScaleBasedLayers()
removeLegendFromLayer()
resetInternalData()
sender()
senderSignalIndex()
timerEvent()