/************************************************************************ * This file has been generated automatically from * * * * src/core/layertree/qgslayertreelayer.h * * * * Do not edit manually ! Edit header and run scripts/sipify.pl again * ************************************************************************/ class QgsLayerTreeLayer : QgsLayerTreeNode { %Docstring Layer tree node points to a map layer. The node can exist also without a valid instance of a layer (just ID). That means the referenced layer does not need to be loaded in order to use it in layer tree. In such case, resolveReferences() method can be called once the layer is loaded. A map layer is supposed to be present in one layer tree just once. It is however possible that temporarily a layer exists in one tree more than just once, e.g. while reordering items with drag and drop. .. versionadded:: 2.4 %End %TypeHeaderCode #include "qgslayertreelayer.h" %End public: explicit QgsLayerTreeLayer( QgsMapLayer *layer ); explicit QgsLayerTreeLayer( const QString &layerId, const QString &name = QString(), const QString &source = QString(), const QString &provider = QString() ); %Docstring Constructor for QgsLayerTreeLayer using weak references to layer ID, ``name``, public ``source``, and ``provider`` key. %End QString layerId() const; %Docstring Returns the ID for the map layer associated with this node. .. seealso:: :py:func:`layer` %End QgsMapLayer *layer() const; %Docstring Returns the map layer associated with this node. .. warning:: This can be (and often is!) a None, e.g. in the case of a layer node representing a layer which has not yet been fully loaded into a project, or a layer node representing a layer with an invalid data source. The returned pointer must ALWAYS be checked to avoid dereferencing a None. .. seealso:: :py:func:`layerId` %End virtual QString name() const; %Docstring Returns the layer's name. .. seealso:: :py:func:`setName` .. versionadded:: 3.0 %End virtual void setName( const QString &n ); %Docstring Sets the layer's name. .. seealso:: :py:func:`name` .. versionadded:: 3.0 %End static QgsLayerTreeLayer *readXml( QDomElement &element, const QgsReadWriteContext &context ) /Factory/; %Docstring Read layer node from XML. Returns new instance. Does not resolve textual references to layers. Call resolveReferences() afterwards to do it. %End static QgsLayerTreeLayer *readXml( QDomElement &element, const QgsProject *project, const QgsReadWriteContext &context ) /Factory/; %Docstring Read layer node from XML. Returns new instance. Also resolves textual references to layers from the project (calls resolveReferences() internally). .. versionadded:: 3.0 %End virtual void writeXml( QDomElement &parentElement, const QgsReadWriteContext &context ); virtual QString dump() const; virtual QgsLayerTreeLayer *clone() const /Factory/; virtual void resolveReferences( const QgsProject *project, bool looseMatching = false ); %Docstring Resolves reference to layer from stored layer ID (if it has not been resolved already) .. versionadded:: 3.0 %End signals: void layerLoaded(); %Docstring Emitted when a previously unavailable layer got loaded. %End void layerWillBeUnloaded(); %Docstring Emitted when a previously available layer got unloaded (from layer registry). .. versionadded:: 2.6 %End protected: void attachToLayer(); private: QgsLayerTreeLayer( const QgsLayerTreeLayer &other ); %Docstring Copies are not allowed %End }; /************************************************************************ * This file has been generated automatically from * * * * src/core/layertree/qgslayertreelayer.h * * * * Do not edit manually ! Edit header and run scripts/sipify.pl again * ************************************************************************/