66 return qobject_cast<QgsLayerTreeGroup *>( node );
77 return qobject_cast<QgsLayerTreeLayer *>( node );
88 return qobject_cast< const QgsLayerTreeLayer *>( node );
97 SIP_PYOBJECT __repr__();
100 QString
str = QStringLiteral(
"<qgis._core.QgsLayerTree object at 0x%1>" ).arg(
reinterpret_cast<quintptr
>( sipCpp ), 2 * QT_POINTER_SIZE, 16, QLatin1Char(
'0' ) );
101 sipRes = PyUnicode_FromString(
str.toUtf8().constData() );
116 QList<QgsMapLayer *> customLayerOrder()
const;
129 void setCustomLayerOrder(
const QList<QgsMapLayer *> &customLayerOrder );
142 void setCustomLayerOrder(
const QStringList &customLayerOrder )
SIP_PYNAME( setCustomLayerOrderByIds );
154 QList<QgsMapLayer *> layerOrder()
const;
164 bool hasCustomLayerOrder()
const;
174 void setHasCustomLayerOrder(
bool hasCustomLayerOrder );
192 void readLayerOrderFromXml(
const QDomElement &doc );
212 void customLayerOrderChanged();
219 void layerOrderChanged();
228 void hasCustomLayerOrderChanged(
bool hasCustomLayerOrder );
231 void nodeAddedChildren(
QgsLayerTreeNode *node,
int indexFrom,
int indexTo );
232 void nodeRemovedChildren();
240 void addMissingLayers();
242 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.