16#ifndef QGSLAYERTREENODE_H
17#define QGSLAYERTREENODE_H
82 if ( sipCpp->inherits(
"QgsLayerTreeNode" ) )
84 sipType = sipType_QgsLayerTreeNode;
87 sipType = sipType_QgsLayerTreeLayer;
88 else if ( qobject_cast<QgsLayerTree *>( sipCpp ) )
89 sipType = sipType_QgsLayerTree;
91 sipType = sipType_QgsLayerTreeGroup;
110 SIP_PYOBJECT __repr__();
112 QString
str = QStringLiteral(
"<QgsLayerTreeNode: %1>" ).arg( sipCpp->name() );
113 sipRes = PyUnicode_FromString(
str.toUtf8().constData() );
122 QList<QgsLayerTreeNode *>
children() {
return mChildren; }
131 QList<QgsLayerTreeNode *> abandonChildren()
SIP_SKIP;
136 virtual QString name() const = 0;
141 virtual
void setName( const QString &name ) = 0;
159 virtual QString dump() const = 0;
172 virtual
void resolveReferences( const
QgsProject *project,
bool looseMatching = false ) = 0;
177 bool isVisible() const;
182 bool itemVisibilityChecked()
const {
return mChecked; }
190 void setItemVisibilityChecked(
bool checked );
195 virtual void setItemVisibilityCheckedRecursive(
bool checked );
200 void setItemVisibilityCheckedParentRecursive(
bool checked );
205 bool isItemVisibilityCheckedRecursive()
const;
210 bool isItemVisibilityUncheckedRecursive()
const;
216 QList< QgsMapLayer * > checkedLayers()
const;
225 bool isExpanded()
const;
227 void setExpanded(
bool expanded );
230 void setCustomProperty(
const QString &key,
const QVariant &value );
232 QVariant customProperty(
const QString &key,
const QVariant &defaultValue = QVariant() )
const;
234 void removeCustomProperty(
const QString &key );
236 QStringList customProperties()
const;
271 void readCommonXml( QDomElement &element );
273 void writeCommonXml( QDomElement &element );
276 void insertChildrenPrivate(
int index,
const QList<QgsLayerTreeNode *> &nodes );
278 void removeChildrenPrivate(
int from,
int count,
bool destroy =
true );
This class is a base class for nodes in a layer tree.
NodeType
Enumeration of possible tree node types.
@ NodeGroup
Container of other groups and layers.
void removedChildren(QgsLayerTreeNode *node, int indexFrom, int indexTo)
Emitted when one or more nodes has been removed from a node within the tree.
void nameChanged(QgsLayerTreeNode *node, QString name)
Emitted when the name of the node is changed.
QList< QgsLayerTreeNode * > children()
Gets list of children of the node. Children are owned by the parent.
void willRemoveChildren(QgsLayerTreeNode *node, int indexFrom, int indexTo)
Emitted when one or more nodes will be removed from a node within the tree.
QgsLayerTreeNode * parent()
Gets pointer to the parent. If parent is nullptr, the node is a root node.
NodeType nodeType() const
Find out about type of the node. It is usually shorter to use convenience functions from QgsLayerTree...
QgsObjectCustomProperties mProperties
custom properties attached to the node
void customPropertyChanged(QgsLayerTreeNode *node, const QString &key)
Emitted when a custom property of a node within the tree has been changed or removed.
NodeType mNodeType
type of the node - determines which subclass is used
QList< QgsLayerTreeNode * > children() const
Gets list of children of the node. Children are owned by the parent.
void addedChildren(QgsLayerTreeNode *node, int indexFrom, int indexTo)
Emitted when one or more nodes have been added to a node within the tree.
void willAddChildren(QgsLayerTreeNode *node, int indexFrom, int indexTo)
Emitted when one or more nodes will be added to a node within the tree.
void visibilityChanged(QgsLayerTreeNode *node)
Emitted when check state of a node within the tree has been changed.
QList< QgsLayerTreeNode * > mChildren
list of children - node is responsible for their deletion
bool mExpanded
whether the node should be shown in GUI as expanded
void expandedChanged(QgsLayerTreeNode *node, bool expanded)
Emitted when the collapsed/expanded state of a node within the tree has been changed.
static bool isLayer(const QgsLayerTreeNode *node)
Check whether the node is a valid layer node.
static bool isGroup(QgsLayerTreeNode *node)
Check whether the node is a valid group node.
Base class for all map layer types.
Simple key-value store (keys = strings, values = variants) that supports loading/saving to/from XML i...
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
The class is used as a container of context for various read/write operations on other objects.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)