25 , mLayerId( layer->id() )
27 , mVisible( Qt::Checked )
38 , mVisible( Qt::Checked )
45 , mLayerId( other.mLayerId )
46 , mLayerName( other.mLayerName )
48 , mVisible( other.mVisible )
98 if ( element.
tagName() !=
"layer-tree-layer" )
virtual QgsLayerTreeNode * clone() const override
Create a copy of the node. Returns new instance.
Base class for all map layer types.
static Qt::CheckState checkStateFromXml(QString txt)
Convert QString to Qt::CheckState.
void setLayerName(const QString &n)
static QString checkStateToXml(Qt::CheckState state)
Convert Qt::CheckState to QString.
QDomNode appendChild(const QDomNode &newChild)
QString attribute(const QString &name, const QString &defValue) const
QgsMapLayer * layer() const
bool mExpanded
whether the node should be shown in GUI as expanded
bool contains(const QString &str, Qt::CaseSensitivity cs) const
void readCommonXML(QDomElement &element)
void layerLoaded()
emitted when a previously unavailable layer got loaded
void registryLayersWillBeRemoved(const QStringList &layerIds)
bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method)
const QString & name() const
Get the display name of the layer.
void visibilityChanged(QgsLayerTreeNode *node, Qt::CheckState state)
Emitted when check state of a node within the tree has been changed.
void registryLayersAdded(QList< QgsMapLayer * > layers)
QDomDocument ownerDocument() const
void setAttribute(const QString &name, const QString &value)
virtual void writeXML(QDomElement &parentElement) override
Write layer tree to XML.
This class is a base class for nodes in a layer tree.
QString id() const
Get this layer's unique ID, this ID is used to access this layer from map layer registry.
void setVisible(Qt::CheckState visible)
bool isExpanded() const
Return whether the node should be shown as expanded or collapsed in GUI.
void setExpanded(bool expanded)
Set whether the node should be shown as expanded or collapsed in GUI.
static QgsMapLayerRegistry * instance()
Returns the instance pointer, creating the object on the first call.
void writeCommonXML(QDomElement &element)
void layerWillBeUnloaded()
emitted when a previously available layer got unloaded (from layer registry)
static QgsLayerTreeLayer * readXML(QDomElement &element)
void setLayerName(const QString &name)
Set the display name of the layer.
QgsMapLayer * mapLayer(QString theLayerId)
Retrieve a pointer to a loaded layer by id.
virtual QString dump() const override
Return string with layer tree structure. For debug purposes only.
QDomElement createElement(const QString &tagName)
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QString layerName() const
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
Layer tree node points to a map layer.
QgsLayerTreeLayer(QgsMapLayer *layer)