16 #ifndef QGSLAYERTREELAYER_H    17 #define QGSLAYERTREELAYER_H    19 #include "qgis_core.h"    55     explicit QgsLayerTreeLayer( 
const QString &layerId, 
const QString &name = QString(), 
const QString &source = QString(), 
const QString &provider = QString() );
    62     QString 
layerId()
 const { 
return mRef.layerId; }
    82     QString 
name() 
const override;
    91     void setName( 
const QString &n ) 
override;
   108     QString 
dump() 
const override;
   129     void layerWillBeUnloaded();
   132     void attachToLayer();
   145     void layerNameChanged();
   151     void layerWillBeDeleted();
   166 #endif // QGSLAYERTREELAYER_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. 
 
virtual QString name() const =0
Returns name of the node. 
 
virtual void setName(const QString &name)=0
Set name of the node. 
 
virtual void writeXml(QDomElement &parentElement, const QgsReadWriteContext &context)=0
Write layer tree to XML. 
 
QgsMapLayer * layer() const 
Returns the map layer associated with this node. 
 
virtual QgsLayerTreeNode * clone() const =0
Create a copy of the node. Returns new instance. 
 
virtual QString dump() const =0
Returns string with layer tree structure. For debug purposes only. 
 
static QgsLayerTreeNode * readXml(QDomElement &element, const QgsReadWriteContext &context)
Read layer tree from XML. 
 
QgsMapLayerRef mRef
Weak reference to the layer (or just it's ID if the reference is not resolved yet) ...
 
QString mLayerName
Layer name - only used if layer does not exist. 
 
This class is a base class for nodes in a layer tree. 
 
QString layerId() const 
Returns the ID for the map layer associated with this node. 
 
Reads and writes project states. 
 
virtual void resolveReferences(const QgsProject *project, bool looseMatching=false)=0
Turn textual references to layers into map layer object from project. 
 
Layer tree node points to a map layer.