Subgroup: Layer
Class: QgsLayerTree¶
-
class
qgis.core.
QgsLayerTree
¶ Bases:
qgis._core.QgsLayerTreeGroup
Namespace with helper functions for layer tree operations.
Only generally useful routines should be here. Miscellaneous utility functions for work with the layer tree are in QgsLayerTreeUtils class.
New in version 3.0: Methods
addChildNode
Append an existing node. addGroup
Append a new group node with given name. addLayer
Append a new layer node for given map layer. blockSignals
checkedLayers
Returns a list of any checked layers which belong to this node or its children. childEvent
children
Get list of children of the node. clear
Clear any information from this layer tree. clone
connectNotify
customEvent
customLayerOrder
The order in which layers will be rendered on the canvas. customProperties
Return list of keys stored in custom properties customProperty
Read a custom property from layer. deleteLater
disconnect
disconnectNotify
dump
Return text representation of the tree. dumpObjectInfo
dumpObjectTree
dynamicPropertyNames
event
eventFilter
findChild
findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject findChildren
findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findGroup
Find group node with specified name. findLayer
Find layer node representing the map layer. findLayerIds
Find layer IDs used in all layer nodes. findLayers
Find all layer nodes. hasCustomLayerOrder
Determines if the layer order should be derived from the layer tree or if a custom override order shall be used instead. inherits
insertChildNode
Insert existing node at specified position. insertChildNodes
Insert existing nodes at specified position. insertChildrenPrivate
insertGroup
Insert a new group node with given name at specified position. insertLayer
Insert a new layer node for given map layer at specified position. installEventFilter
isExpanded
Return whether the node should be shown as expanded or collapsed in GUI isGroup
Check whether the node is a valid group node isItemVisibilityCheckedRecursive
Return whether this node is checked and all its children. isItemVisibilityUncheckedRecursive
Return whether this node is unchecked and all its children. isLayer
Check whether the node is a valid layer node isMutuallyExclusive
Return whether the group is mutually exclusive (only one child can be checked at a time) isSignalConnected
isVisible
Returns whether a node is really visible (ie checked and all its ancestors checked as well) isWidgetType
isWindowType
itemVisibilityChecked
Returns whether a node is checked (independently of its ancestors or children) killTimer
layerOrder
The order in which layers will be rendered on the canvas. metaObject
moveToThread
name
Returns the group’s name. nodeType
Find out about type of the node. nodeVisibilityChanged
objectName
parent
Get pointer to the parent. property
pyqtConfigure
Each keyword argument is either the name of a Qt property or a Qt signal. readChildrenFromXml
Read children from XML and append them to the group. readCommonXml
readLayerOrderFromXml
Load the layer order from an XML element. readXml
Load the layer tree from an XML element. receivers
removeAllChildren
Remove all child nodes. removeChildNode
Remove a child node from this group. removeChildren
Remove child nodes from index “from”. removeChildrenGroupWithoutLayers
Remove all child group nodes without layers. removeChildrenPrivate
removeCustomProperty
Remove a custom property from layer. removeEventFilter
removeLayer
Remove map layer’s node from this group. resolveReferences
Calls resolveReferences() on child tree nodes sender
senderSignalIndex
setCustomLayerOrder
The order in which layers will be rendered on the canvas. setCustomLayerOrderByIds
The order in which layers will be rendered on the canvas. setCustomProperty
Set a custom property for the node. setExpanded
Set whether the node should be shown as expanded or collapsed in GUI setHasCustomLayerOrder
Determines if the layer order should be derived from the layer tree or if a custom override order shall be used instead. setIsMutuallyExclusive
Set whether the group is mutually exclusive (only one child can be checked at a time). setItemVisibilityChecked
Check or uncheck a node (independently of its ancestors or children) setItemVisibilityCheckedParentRecursive
Check or uncheck a node and all its parents setItemVisibilityCheckedRecursive
Check or uncheck a node and all its children (taking into account exclusion rules) setName
Sets the group’s name. setObjectName
setParent
setProperty
signalsBlocked
startTimer
takeChild
Remove a child from a node thread
timerEvent
tr
updateChildVisibilityMutuallyExclusive
writeCommonXml
writeXml
Attributes
NodeGroup
NodeLayer
addedChildren
Emitted when one or more nodes have been added to a node within the tree [signal] customLayerOrderChanged
Emitted when the custom layer order has changed. customPropertyChanged
Emitted when a custom property of a node within the tree has been changed or removed [signal] destroyed
destroyed(self, QObject = None) [signal] expandedChanged
Emitted when the collapsed/expanded state of a node within the tree has been changed [signal] hasCustomLayerOrderChanged
Emitted when the hasCustomLayerOrder flag changes. layerOrderChanged
Emitted when the layer order has changed. nameChanged
Emitted when the name of the node is changed objectNameChanged
objectNameChanged(self, str) [signal] removedChildren
Emitted when one or more nodes has been removed from a node within the tree [signal] staticMetaObject
visibilityChanged
Emitted when check state of a node within the tree has been changed [signal] willAddChildren
Emitted when one or more nodes will be added to a node within the tree [signal] willRemoveChildren
Emitted when one or more nodes will be removed from a node within the tree [signal] -
childEvent
()¶
-
clear
(self)¶ Clear any information from this layer tree.
New in version 3.0.
-
clone
(self) → QgsLayerTree¶
-
connectNotify
()¶
-
customEvent
()¶
-
customLayerOrder
(self) → List[QgsMapLayer]¶ The order in which layers will be rendered on the canvas. Will only be used if the property hasCustomLayerOrder is true. If you need the current layer order that is active, prefer using layerOrder().
See also
See also
See also
New in version 3.0.
-
customLayerOrderChanged
¶ Emitted when the custom layer order has changed.
New in version 3.0: [signal]
-
disconnectNotify
()¶
-
hasCustomLayerOrder
(self) → bool¶ Determines if the layer order should be derived from the layer tree or if a custom override order shall be used instead.
See also
New in version 3.0.
-
hasCustomLayerOrderChanged
¶ Emitted when the hasCustomLayerOrder flag changes.
See also
New in version 3.0: [signal]
-
insertChildrenPrivate
()¶
-
isGroup
(node: QgsLayerTreeNode) → bool¶ Check whether the node is a valid group node
New in version 2.4.
-
isLayer
(node: QgsLayerTreeNode) → bool¶ Check whether the node is a valid layer node
New in version 2.4.
-
isSignalConnected
()¶
-
layerOrder
(self) → List[QgsMapLayer]¶ The order in which layers will be rendered on the canvas. Depending on hasCustomLayerOrder, this will return either the override customLayerOrder or the layer order derived from the tree. This property is read only.
See also
New in version 3.0.
-
layerOrderChanged
¶ Emitted when the layer order has changed.
New in version 3.0: [signal]
-
nodeVisibilityChanged
()¶
-
readCommonXml
()¶
-
readLayerOrderFromXml
(self, doc: QDomElement)¶ Load the layer order from an XML element. Make sure that this is only called after the layers are loaded.
New in version 3.0.
-
readXml
(element: QDomElement, context: QgsReadWriteContext) → QgsLayerTree¶ Load the layer tree from an XML element. It is not required that layers are loaded at this point. resolveReferences() needs to be called after loading the layers and before using the tree.
New in version 3.0.
-
receivers
()¶
-
removeChildrenPrivate
()¶
-
sender
()¶
-
senderSignalIndex
()¶
-
setCustomLayerOrder
(self, customLayerOrder: Iterable[QgsMapLayer])¶ The order in which layers will be rendered on the canvas. Will only be used if the property hasCustomLayerOrder is true. If you need the current layer order that is active, prefer using layerOrder().
See also
See also
See also
New in version 3.0.
-
setCustomLayerOrderByIds
(self, customLayerOrder: Iterable[str])¶ The order in which layers will be rendered on the canvas. Will only be used if the property hasCustomLayerOrder is true. If you need the current layer order that is active, prefer using layerOrder().
See also
See also
See also
New in version 3.0.
-
setHasCustomLayerOrder
(self, hasCustomLayerOrder: bool)¶ Determines if the layer order should be derived from the layer tree or if a custom override order shall be used instead.
See also
New in version 3.0.
-
timerEvent
()¶
-
updateChildVisibilityMutuallyExclusive
()¶
-
writeCommonXml
()¶
-
writeXml
(self, parentElement: QDomElement, context: QgsReadWriteContext)¶
-