16 #ifndef QGSLAYERTREENODE_H
17 #define QGSLAYERTREENODE_H
19 #include "qgis_core.h"
81 if ( sipCpp->inherits(
"QgsLayerTreeNode" ) )
83 sipType = sipType_QgsLayerTreeNode;
86 sipType = sipType_QgsLayerTreeLayer;
87 else if ( qobject_cast<QgsLayerTree *>( sipCpp ) )
88 sipType = sipType_QgsLayerTree;
90 sipType = sipType_QgsLayerTreeGroup;
113 QList<QgsLayerTreeNode *>
children() {
return mChildren; }
122 QList<QgsLayerTreeNode *> abandonChildren()
SIP_SKIP;
128 virtual QString name() const = 0;
134 virtual
void setName( const QString &name ) = 0;
153 virtual QString dump() const = 0;
167 virtual
void resolveReferences( const
QgsProject *project,
bool looseMatching = false ) = 0;
173 bool isVisible() const;
179 bool itemVisibilityChecked()
const {
return mChecked; }
188 void setItemVisibilityChecked(
bool checked );
194 virtual void setItemVisibilityCheckedRecursive(
bool checked );
200 void setItemVisibilityCheckedParentRecursive(
bool checked );
206 bool isItemVisibilityCheckedRecursive()
const;
212 bool isItemVisibilityUncheckedRecursive()
const;
219 QList< QgsMapLayer * > checkedLayers()
const;
228 bool isExpanded()
const;
230 void setExpanded(
bool expanded );
233 void setCustomProperty(
const QString &key,
const QVariant &value );
235 QVariant customProperty(
const QString &key,
const QVariant &defaultValue = QVariant() )
const;
237 void removeCustomProperty(
const QString &key );
239 QStringList customProperties()
const;
275 void readCommonXml( QDomElement &element );
277 void writeCommonXml( QDomElement &element );
280 void insertChildrenPrivate(
int index, QList<QgsLayerTreeNode *> nodes );
282 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.
void willRemoveChildren(QgsLayerTreeNode *node, int indexFrom, int indexTo)
Emitted when one or more nodes will be removed from a node within the tree.
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
QgsLayerTreeNode * parent()
Gets pointer to the parent. If parent is nullptr, the node is a root node.
void addedChildren(QgsLayerTreeNode *node, int indexFrom, int indexTo)
Emitted when one or more nodes have been added to a node within the tree.
QList< QgsLayerTreeNode * > children()
Gets list of children of the node. Children are owned by the parent.
void willAddChildren(QgsLayerTreeNode *node, int indexFrom, int indexTo)
Emitted when one or more nodes will be added to a node within the tree.
QList< QgsLayerTreeNode * > children() const
Gets list of children of the node. Children are owned by the parent.
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)