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.
List of all members, including inherited members
Class Hierarchy¶
Base classes¶
Base class for nodes in a layer tree. |
|
Constructor
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 (str|None) – Unique identifier of the custom node.
nodeName (str|None = '') – Optional name of the custom node.
checked (bool = True) – Whether the custom node should be checked or not once it is created.
- abstract clone(self) QgsLayerTreeCustomNode | None[source]¶
- Return type:
- nodeId(self) str[source]¶
Returns the node’s unique identifier.
Deprecated since version 4.4: Use
id()instead.- Return type:
str
- 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
Noneon error).- Parameters:
element (QDomElement)
context (QgsReadWriteContext)
- Return type:
- 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)