16#ifndef QGSLAYERTREENODE_H
17#define QGSLAYERTREENODE_H
83 if ( sipCpp->inherits(
"QgsLayerTreeNode" ) )
85 sipType = sipType_QgsLayerTreeNode;
88 sipType = sipType_QgsLayerTreeLayer;
89 else if ( qobject_cast<QgsLayerTree *>( sipCpp ) )
90 sipType = sipType_QgsLayerTree;
92 sipType = sipType_QgsLayerTreeGroup;
111 SIP_PYOBJECT __repr__();
113 QString
str = QStringLiteral(
"<QgsLayerTreeNode: %1>" ).arg( sipCpp->name() );
114 sipRes = PyUnicode_FromString(
str.toUtf8().constData() );
123 QList<QgsLayerTreeNode *>
children() {
return mChildren; }
132 QList<QgsLayerTreeNode *> abandonChildren()
SIP_SKIP;
138 virtual QString name() const = 0;
144 virtual
void setName( const QString &name ) = 0;
163 virtual QString dump() const = 0;
177 virtual
void resolveReferences( const
QgsProject *project,
bool looseMatching = false ) = 0;
183 bool isVisible() const;
189 bool itemVisibilityChecked()
const {
return mChecked; }
198 void setItemVisibilityChecked(
bool checked );
204 virtual void setItemVisibilityCheckedRecursive(
bool checked );
210 void setItemVisibilityCheckedParentRecursive(
bool checked );
216 bool isItemVisibilityCheckedRecursive()
const;
222 bool isItemVisibilityUncheckedRecursive()
const;
229 QList< QgsMapLayer * > checkedLayers()
const;
238 bool isExpanded()
const;
240 void setExpanded(
bool expanded );
243 void setCustomProperty(
const QString &key,
const QVariant &value );
245 QVariant customProperty(
const QString &key,
const QVariant &defaultValue = QVariant() )
const;
247 void removeCustomProperty(
const QString &key );
249 QStringList customProperties()
const;
285 void readCommonXml( QDomElement &element );
287 void writeCommonXml( QDomElement &element );
290 void insertChildrenPrivate(
int index,
const QList<QgsLayerTreeNode *> &nodes );
292 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)