16 #ifndef QGSLAYERTREENODE_H 17 #define QGSLAYERTREENODE_H 19 #include "qgis_core.h" 78 if ( sipCpp->inherits(
"QgsLayerTreeNode" ) )
80 sipType = sipType_QgsLayerTreeNode;
83 sipType = sipType_QgsLayerTreeLayer;
84 else if ( qobject_cast<QgsLayerTree *>( sipCpp ) )
85 sipType = sipType_QgsLayerTree;
87 sipType = sipType_QgsLayerTreeGroup;
110 QList<QgsLayerTreeNode *>
children() {
return mChildren; }
118 virtual QString name()
const = 0;
124 virtual void setName(
const QString &name ) = 0;
140 virtual void writeXml( QDomElement &parentElement,
const QgsReadWriteContext &context ) = 0;
143 virtual QString dump()
const = 0;
157 virtual void resolveReferences(
const QgsProject *project,
bool looseMatching =
false ) = 0;
163 bool isVisible()
const;
178 void setItemVisibilityChecked(
bool checked );
184 virtual void setItemVisibilityCheckedRecursive(
bool checked );
190 void setItemVisibilityCheckedParentRecursive(
bool checked );
196 bool isItemVisibilityCheckedRecursive()
const;
202 bool isItemVisibilityUncheckedRecursive()
const;
209 QList< QgsMapLayer * > checkedLayers()
const;
212 bool isExpanded()
const;
214 void setExpanded(
bool expanded );
217 void setCustomProperty(
const QString &key,
const QVariant &value );
219 QVariant customProperty(
const QString &key,
const QVariant &defaultValue = QVariant() )
const;
221 void removeCustomProperty(
const QString &key );
223 QStringList customProperties()
const;
234 void willRemoveChildren(
QgsLayerTreeNode *node,
int indexFrom,
int indexTo );
259 void readCommonXml( QDomElement &element );
261 void writeCommonXml( QDomElement &element );
264 void insertChildrenPrivate(
int index, QList<QgsLayerTreeNode *> nodes );
266 void removeChildrenPrivate(
int from,
int count,
bool destroy =
true );
285 #endif // QGSLAYERTREENODE_H The class is used as a container of context for various read/write operations on other objects...
Base class for all map layer types.
static bool isGroup(QgsLayerTreeNode *node)
Check whether the node is a valid group node.
bool itemVisibilityChecked() const
Returns whether a node is checked (independently of its ancestors or children)
bool mExpanded
whether the node should be shown in GUI as expanded
NodeType
Enumeration of possible tree node types.
NodeType mNodeType
type of the node - determines which subclass is used
QList< QgsLayerTreeNode * > children()
Gets list of children of the node. Children are owned by the parent.
QgsLayerTreeNode * parent()
Gets pointer to the parent. If parent is nullptr, the node is a root node.
static bool isLayer(const QgsLayerTreeNode *node)
Check whether the node is a valid layer node.
This class is a base class for nodes in a layer tree.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts, annotations, canvases, etc.
NodeType nodeType() const
Find out about type of the node. It is usually shorter to use convenience functions from QgsLayerTree...
QList< QgsLayerTreeNode * > children() const
Gets list of children of the node. Children are owned by the parent.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Simple key-value store (keys = strings, values = variants) that supports loading/saving to/from XML i...
QList< QgsLayerTreeNode * > mChildren
list of children - node is responsible for their deletion
Container of other groups and layers.
QgsObjectCustomProperties mProperties
custom properties attached to the node