Class: QgsLayerTreeCustomNode¶
Layer tree custom node serves as a node for objects that are not layers nor groups.
They are created, and can be found based on a node ID, which should be unique in the whole layer tree.
Added in version 4.0.
Class Hierarchy¶
Base classes¶
Base class for nodes in a layer tree. |
|
Abstract Methods
Returns the node's name. |
|
Sets the node's name. |
|
Write custom node as XML element <layer-tree-custom-node> and add it to the given parent element. |
Methods
Returns the node's unique identifier. |
Static Methods
Read custom node from XML element <layer-tree-custom-node> and return the newly created node (or |
- class qgis.core.QgsLayerTreeCustomNode[source]¶
Bases:
QgsLayerTreeNode
- __init__(nodeId: str | None, nodeName: str | None = '', checked: bool = True)
Constructor to create custom nodes that represent application objects other than layers and groups.
- Parameters:
nodeId (Optional[str]) – Unique identifier of the custom node.
nodeName (Optional[str] = '') – Optional name of the custom node.
checked (bool = True) – Whether the custom node should be checked or not once it is created.
- static readXml(element: QDomElement, context: QgsReadWriteContext) QgsLayerTreeCustomNode | None [source]¶
Read custom node from XML element <layer-tree-custom-node> and return the newly created node (or
None
on error).- Parameters:
element (QDomElement)
context (QgsReadWriteContext)
- Return type:
Optional[QgsLayerTreeCustomNode]
- abstract setName(self, name: str | None)[source]¶
Sets the node’s name.
- Parameters:
name (Optional[str])
- abstract writeXml(self, parentElement: QDomElement, context: QgsReadWriteContext)[source]¶
Write custom node as XML element <layer-tree-custom-node> and add it to the given parent element.
- Parameters:
parentElement (QDomElement)
context (QgsReadWriteContext)