62 return qobject_cast<QgsLayerTreeGroup *>( node );
72 return qobject_cast<QgsLayerTreeLayer *>( node );
82 return qobject_cast< const QgsLayerTreeLayer *>( node );
91 SIP_PYOBJECT __repr__();
94 QString str = QStringLiteral(
"<qgis._core.QgsLayerTree object at 0x%1>" ).arg(
reinterpret_cast<quintptr
>( sipCpp ), 2 * QT_POINTER_SIZE, 16, QLatin1Char(
'0' ) );
95 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
109 QList<QgsMapLayer *> customLayerOrder()
const;
121 void setCustomLayerOrder(
const QList<QgsMapLayer *> &customLayerOrder );
133 void setCustomLayerOrder(
const QStringList &customLayerOrder )
SIP_PYNAME( setCustomLayerOrderByIds );
144 QList<QgsMapLayer *> layerOrder()
const;
153 bool hasCustomLayerOrder()
const;
162 void setHasCustomLayerOrder(
bool hasCustomLayerOrder );
178 void readLayerOrderFromXml(
const QDomElement &doc );
196 void customLayerOrderChanged();
202 void layerOrderChanged();
210 void hasCustomLayerOrderChanged(
bool hasCustomLayerOrder );
213 void nodeAddedChildren(
QgsLayerTreeNode *node,
int indexFrom,
int indexTo );
214 void nodeRemovedChildren();
221 void addMissingLayers();
223 bool mHasCustomLayerOrder = false;
Layer tree group node serves as a container for layers and further groups.
void writeXml(QDomElement &parentElement, const QgsReadWriteContext &context) override
Write group (tree) as XML element <layer-tree-group> and add it to the given parent element.
QgsLayerTreeGroup * clone() const override
Returns a clone of the group.
static QgsLayerTreeGroup * readXml(QDomElement &element, const QgsReadWriteContext &context)
Read group (tree) from XML element <layer-tree-group> and return the newly created group (or nullptr ...
Layer tree node points to a map layer.
This class is a base class for nodes in a layer tree.
@ NodeGroup
Container of other groups and layers.
@ NodeLayer
Leaf node pointing to a layer.
NodeType nodeType() const
Find out about type of the node. It is usually shorter to use convenience functions from QgsLayerTree...
Namespace with helper functions for layer tree operations.
static QgsLayerTreeLayer * toLayer(QgsLayerTreeNode *node)
Cast node to a layer.
static bool isLayer(const QgsLayerTreeNode *node)
Check whether the node is a valid layer node.
static const QgsLayerTreeLayer * toLayer(const QgsLayerTreeNode *node)
Cast node to a layer.
static bool isGroup(QgsLayerTreeNode *node)
Check whether the node is a valid group node.
static QgsLayerTreeGroup * toGroup(QgsLayerTreeNode *node)
Cast node to a group.
The class is used as a container of context for various read/write operations on other objects.
QList< QgsWeakMapLayerPointer > QgsWeakMapLayerPointerList
A list of weak pointers to QgsMapLayers.