1/************************************************************************ 2 * This file has been generated automatically from * 3 * * 4 * src/core/layertree/qgslayertreelayer.h * 5 * * 6 * Do not edit manually ! Edit header and run scripts/sipify.pl again * 7 ************************************************************************/ 8 9 10 11 12class QgsLayerTreeLayer : QgsLayerTreeNode 13{ 14%Docstring 15Layer tree node points to a map layer. 16 17The node can exist also without a valid instance of a layer (just ID). That 18means the referenced layer does not need to be loaded in order to use it 19in layer tree. In such case, :py:func:`~resolveReferences` method can be called 20once the layer is loaded. 21 22A map layer is supposed to be present in one layer tree just once. It is 23however possible that temporarily a layer exists in one tree more than just 24once, e.g. while reordering items with drag and drop. 25 26.. versionadded:: 2.4 27%End 28 29%TypeHeaderCode 30#include "qgslayertreelayer.h" 31%End 32 public: 33 explicit QgsLayerTreeLayer( QgsMapLayer *layer ); 34 35 36 explicit QgsLayerTreeLayer( const QString &layerId, const QString &name = QString(), const QString &source = QString(), const QString &provider = QString() ); 37%Docstring 38Constructor for QgsLayerTreeLayer using weak references to layer ID, ``name``, public ``source``, and ``provider`` key. 39%End 40 41 QString layerId() const; 42%Docstring 43Returns the ID for the map layer associated with this node. 44 45.. seealso:: :py:func:`layer` 46%End 47 48 QgsMapLayer *layer() const; 49%Docstring 50Returns the map layer associated with this node. 51 52.. warning:: 53 54 This can be (and often is!) ``None``, e.g. in the case of a layer node representing a layer 55 which has not yet been fully loaded into a project, or a layer node representing a layer 56 with an invalid data source. The returned pointer must ALWAYS be checked to avoid dereferencing ``None``. 57 58.. seealso:: :py:func:`layerId` 59%End 60 61 virtual QString name() const; 62 63%Docstring 64Returns the layer's name. 65 66.. seealso:: :py:func:`setName` 67 68.. versionadded:: 3.0 69%End 70 71 virtual void setName( const QString &n ); 72 73%Docstring 74Sets the layer's name. 75 76.. seealso:: :py:func:`name` 77 78.. versionadded:: 3.0 79%End 80 81 void setUseLayerName( bool use = true ); 82%Docstring 83Uses the layer's name if ``use`` is ``True``, or the name manually set if 84``False``. 85 86.. versionadded:: 3.8 87%End 88 89 bool useLayerName() const; 90%Docstring 91Returns whether the layer's name is used, or the name manually set. 92 93.. versionadded:: 3.8 94%End 95 96 static QgsLayerTreeLayer *readXml( QDomElement &element, const QgsReadWriteContext &context ) /Factory/; 97%Docstring 98Read layer node from XML. Returns new instance. 99Does not resolve textual references to layers. Call :py:func:`~QgsLayerTreeLayer.resolveReferences` afterwards to do it. 100%End 101 102 static QgsLayerTreeLayer *readXml( QDomElement &element, const QgsProject *project, const QgsReadWriteContext &context ) /Factory/; 103%Docstring 104Read layer node from XML. Returns new instance. 105Also resolves textual references to layers from the project (calls :py:func:`~QgsLayerTreeLayer.resolveReferences` internally). 106 107.. versionadded:: 3.0 108%End 109 110 virtual void writeXml( QDomElement &parentElement, const QgsReadWriteContext &context ); 111 112 113 virtual QString dump() const; 114 115 116 virtual QgsLayerTreeLayer *clone() const /Factory/; 117 118 119 virtual void resolveReferences( const QgsProject *project, bool looseMatching = false ); 120 121%Docstring 122Resolves reference to layer from stored layer ID (if it has not been resolved already) 123 124.. versionadded:: 3.0 125%End 126 127 void setLabelExpression( const QString &expression ); 128%Docstring 129set the expression to evaluate 130 131.. versionadded:: 3.10 132%End 133 134 QString labelExpression() const; 135%Docstring 136Returns the expression member of the LayerTreeNode 137 138.. versionadded:: 3.10 139%End 140 141 QgsLegendPatchShape patchShape() const; 142%Docstring 143Returns the symbol patch shape to use when rendering the legend node symbol. 144 145.. seealso:: :py:func:`setPatchShape` 146 147.. versionadded:: 3.14 148%End 149 150 void setPatchShape( const QgsLegendPatchShape &shape ); 151%Docstring 152Sets the symbol patch ``shape`` to use when rendering the legend node symbol. 153 154.. seealso:: :py:func:`patchShape` 155 156.. versionadded:: 3.14 157%End 158 159 QSizeF patchSize() const; 160%Docstring 161Returns the user (overridden) size for the legend node. 162 163If either the width or height are non-zero, they will be used when rendering the legend node instead of the default 164symbol width or height from :py:class:`QgsLegendSettings`. 165 166.. seealso:: :py:func:`setPatchSize` 167 168.. versionadded:: 3.14 169%End 170 171 void setPatchSize( QSizeF size ); 172%Docstring 173Sets the user (overridden) ``size`` for the legend node. 174 175If either the width or height are non-zero, they will be used when rendering the legend node instead of the default 176symbol width or height from :py:class:`QgsLegendSettings`. 177 178.. seealso:: :py:func:`patchSize` 179 180.. versionadded:: 3.14 181%End 182 183 enum LegendNodesSplitBehavior 184 { 185 UseDefaultLegendSetting, 186 AllowSplittingLegendNodesOverMultipleColumns, 187 PreventSplittingLegendNodesOverMultipleColumns, 188 }; 189 190 LegendNodesSplitBehavior legendSplitBehavior() const; 191%Docstring 192Returns the column split behavior for the node. 193 194This value controls how legend nodes belonging the to layer may be split over multiple columns in legends. 195 196.. seealso:: :py:func:`setLegendSplitBehavior` 197 198.. versionadded:: 3.14 199%End 200 201 void setLegendSplitBehavior( LegendNodesSplitBehavior behavior ); 202%Docstring 203Sets the column split ``behavior`` for the node. 204 205This value controls how legend nodes belonging the to layer may be split over multiple columns in legends. 206 207.. seealso:: :py:func:`legendSplitBehavior` 208 209.. versionadded:: 3.14 210%End 211 212 signals: 213 214 void layerLoaded(); 215%Docstring 216Emitted when a previously unavailable layer got loaded. 217%End 218 219 void layerWillBeUnloaded(); 220%Docstring 221Emitted when a previously available layer got unloaded (from layer registry). 222 223.. versionadded:: 2.6 224%End 225 226 protected: 227 void attachToLayer(); 228 229 230 231 private: 232 233 QgsLayerTreeLayer( const QgsLayerTreeLayer &other ); 234%Docstring 235Copies are not allowed 236%End 237}; 238 239 240 241/************************************************************************ 242 * This file has been generated automatically from * 243 * * 244 * src/core/layertree/qgslayertreelayer.h * 245 * * 246 * Do not edit manually ! Edit header and run scripts/sipify.pl again * 247 ************************************************************************/ 248