28 , mLayerId( layer->id() )
30 , mVisible(
Qt::Checked )
90 switch ( layer->
type() )
126 bool foundMatch =
false;
129 if ( layerMatchesSource( layer, source ) )
180 if ( element.
tagName() !=
"layer-tree-layer" )
198 else if ( looseMatch && !source.
isEmpty() )
Base class for all map layer types.
void setLayerName(const QString &n)
LayerMatchParams mLooseMatchParams
Only used when loosely matching to layers - eg when creating a composer legend from template If set t...
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
This class provides qgis with the ability to render raster datasets onto the mapcanvas.
bool mExpanded
whether the node should be shown in GUI as expanded
QgsMapLayer * mapLayer(const QString &theLayerId) const
Retrieve a pointer to a registered layer by layer ID.
bool contains(const QString &str, Qt::CaseSensitivity cs) const
void readCommonXML(QDomElement &element)
bool isExpanded() const
Return whether the node should be shown as expanded or collapsed in GUI.
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)
QgsMapLayer::LayerType type() const
Get the type of the layer.
virtual QString name() const =0
Return a provider name.
void visibilityChanged(QgsLayerTreeNode *node, Qt::CheckState state)
Emitted when check state of a node within the tree has been changed.
void layerNameChanged()
Emits a nameChanged() signal if layer's name has changed.
void attachToSource(const LayerMatchParams &source)
Attempts to attach this layer node to a layer with a matching QgsMapLayer::publicSource().
QString name() const override
Get layer's name.
QString id() const
Get this layer's unique ID, this ID is used to access this layer from map layer registry.
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.
static Qt::CheckState checkStateFromXml(const QString &txt)
Convert QString to Qt::CheckState.
QString publicSource() const
Gets a version of the internal layer definition that has sensitive bits removed (for example...
void setVisible(Qt::CheckState visible)
static QgsLayerTreeLayer * createLayerFromParams(const LayerMatchParams &source)
Creates a layer node which will attach to a layer with matching parameters.
void setName(const QString &name)
Set the display name of the layer.
void setName(const QString &n) override
Set layer's name.
void setExpanded(bool expanded)
Set whether the node should be shown as expanded or collapsed in GUI.
QgsMapLayer * layer() const
leaf node pointing to a layer
QString source
Layer public source.
static QgsMapLayerRegistry * instance()
Returns the instance pointer, creating the object on the first call.
void writeCommonXML(QDomElement &element)
Parameters for loose layer matching.
void layerWillBeUnloaded()
emitted when a previously available layer got unloaded (from layer registry)
QString layerName() const
QString name
Read property of QString layerName.
virtual QString dump() const override
Return string with layer tree structure. For debug purposes only.
void registryLayersAdded(const QList< QgsMapLayer *> &layers)
QgsRasterDataProvider * dataProvider()
Returns the data provider.
static QgsLayerTreeLayer * readXML(QDomElement &element, bool looseMatch=false)
Creates a new layer from an XML definition.
QgsVectorDataProvider * dataProvider()
Returns the data provider.
QDomElement createElement(const QString &tagName)
void nameChanged(QgsLayerTreeNode *node, QString name)
Emitted when the name of the node is changed.
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
Represents a vector layer which manages a vector based data sets.
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
virtual QgsLayerTreeLayer * clone() const override
Create a copy of the node. Returns new instance.
QString providerKey
Provider.
Layer tree node points to a map layer.
QgsLayerTreeLayer(QgsMapLayer *layer)