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;
175 void setItemVisibilityChecked(
bool checked );
181 virtual void setItemVisibilityCheckedRecursive(
bool checked );
187 void setItemVisibilityCheckedParentRecursive(
bool checked );
193 bool isItemVisibilityCheckedRecursive()
const;
199 bool isItemVisibilityUncheckedRecursive()
const;
206 QList< QgsMapLayer * > checkedLayers()
const;
209 bool isExpanded()
const;
211 void setExpanded(
bool expanded );
214 void setCustomProperty(
const QString &key,
const QVariant &value );
216 QVariant customProperty(
const QString &key,
const QVariant &defaultValue = QVariant() )
const;
218 void removeCustomProperty(
const QString &key );
220 QStringList customProperties()
const;
231 void willRemoveChildren(
QgsLayerTreeNode *node,
int indexFrom,
int indexTo );
256 void readCommonXml( QDomElement &element );
258 void writeCommonXml( QDomElement &element );
261 void insertChildrenPrivate(
int index, QList<QgsLayerTreeNode *> nodes );
263 void removeChildrenPrivate(
int from,
int count,
bool destroy =
true );
282 #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()
Get list of children of the node. Children are owned by the parent.
QgsLayerTreeNode * parent()
Get pointer to the parent. If parent is a null pointer, 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.
Reads and writes project states.
NodeType nodeType() const
Find out about type of the node. It is usually shorter to use convenience functions from QgsLayerTree...
QList< QgsLayerTreeNode * > children() const
Get 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