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;
109 SIP_PYOBJECT __repr__();
111 QString
str = QStringLiteral(
"<QgsLayerTreeNode: %1>" ).arg( sipCpp->name() );
112 sipRes = PyUnicode_FromString(
str.toUtf8().constData() );
121 QList<QgsLayerTreeNode *>
children() {
return mChildren; }
130 QList<QgsLayerTreeNode *> abandonChildren()
SIP_SKIP;
136 virtual QString name() const = 0;
142 virtual
void setName( const QString &name ) = 0;
158 virtual
void writeXml( QDomElement &parentElement, const
QgsReadWriteContext &context ) = 0;
161 virtual QString dump() const = 0;
175 virtual
void resolveReferences( const
QgsProject *project,
bool looseMatching = false ) = 0;
181 bool isVisible() const;
187 bool itemVisibilityChecked()
const {
return mChecked; }
196 void setItemVisibilityChecked(
bool checked );
202 virtual void setItemVisibilityCheckedRecursive(
bool checked );
208 void setItemVisibilityCheckedParentRecursive(
bool checked );
214 bool isItemVisibilityCheckedRecursive()
const;
220 bool isItemVisibilityUncheckedRecursive()
const;
227 QList< QgsMapLayer * > checkedLayers()
const;
236 bool isExpanded()
const;
238 void setExpanded(
bool expanded );
241 void setCustomProperty(
const QString &key,
const QVariant &value );
243 QVariant customProperty(
const QString &key,
const QVariant &defaultValue = QVariant() )
const;
245 void removeCustomProperty(
const QString &key );
247 QStringList customProperties()
const;
258 void willRemoveChildren(
QgsLayerTreeNode *node,
int indexFrom,
int indexTo );
283 void readCommonXml( QDomElement &element );
285 void writeCommonXml( QDomElement &element );
288 void insertChildrenPrivate(
int index,
const QList<QgsLayerTreeNode *> &nodes );
290 void removeChildrenPrivate(
int from,
int count,
bool destroy =
true );
316 #endif // QGSLAYERTREENODE_H