1/************************************************************************ 2 * This file has been generated automatically from * 3 * * 4 * src/core/qgsmaplayerlegend.h * 5 * * 6 * Do not edit manually ! Edit header and run scripts/sipify.pl again * 7 ************************************************************************/ 8 9 10 11 12 13 14 15class QgsMapLayerLegend : QObject 16{ 17%Docstring 18The QgsMapLayerLegend class is abstract interface for implementations 19of legends for one map layer. 20 21.. versionadded:: 2.6 22%End 23 24%TypeHeaderCode 25#include "qgsmaplayerlegend.h" 26%End 27 public: 28 29 explicit QgsMapLayerLegend( QObject *parent /TransferThis/ = 0 ); 30%Docstring 31Constructor for QgsMapLayerLegend 32%End 33 34 35 virtual void readXml( const QDomElement &elem, const QgsReadWriteContext &context ); 36%Docstring 37Reads configuration from a DOM element previously written by :py:func:`~QgsMapLayerLegend.writeXml` 38 39.. versionadded:: 3.2 40%End 41 42 virtual QDomElement writeXml( QDomDocument &doc, const QgsReadWriteContext &context ) const; 43%Docstring 44Writes configuration to a DOM element, to be used later with :py:func:`~QgsMapLayerLegend.readXml` 45 46.. versionadded:: 3.2 47%End 48 49 virtual QList<QgsLayerTreeModelLegendNode *> createLayerTreeModelLegendNodes( QgsLayerTreeLayer *nodeLayer ) = 0 /Factory/; 50%Docstring 51Returns list of legend nodes to be used for a particular layer tree layer node. 52Ownership is transferred to the caller. 53%End 54 55 56 static QgsMapLayerLegend *defaultVectorLegend( QgsVectorLayer *vl ) /Factory/; 57%Docstring 58Create new legend implementation for vector layer 59%End 60 61 static QgsMapLayerLegend *defaultRasterLegend( QgsRasterLayer *rl ) /Factory/; 62%Docstring 63Create new legend implementation for raster layer 64%End 65 66 static QgsMapLayerLegend *defaultMeshLegend( QgsMeshLayer *ml ) /Factory/; 67%Docstring 68Create new legend implementation for mesh layer 69%End 70 71 signals: 72 void itemsChanged(); 73%Docstring 74Emitted when existing items/nodes got invalid and should be replaced by new ones 75%End 76}; 77 78 79class QgsMapLayerLegendUtils 80{ 81%Docstring 82Miscellaneous utility functions for handling of map layer legend 83 84.. versionadded:: 2.6 85%End 86 87%TypeHeaderCode 88#include "qgsmaplayerlegend.h" 89%End 90 public: 91 static void setLegendNodeOrder( QgsLayerTreeLayer *nodeLayer, const QList<int> &order ); 92 static QList<int> legendNodeOrder( QgsLayerTreeLayer *nodeLayer ); 93 static bool hasLegendNodeOrder( QgsLayerTreeLayer *nodeLayer ); 94 95 static void setLegendNodeUserLabel( QgsLayerTreeLayer *nodeLayer, int originalIndex, const QString &newLabel ); 96 static QString legendNodeUserLabel( QgsLayerTreeLayer *nodeLayer, int originalIndex ); 97 static bool hasLegendNodeUserLabel( QgsLayerTreeLayer *nodeLayer, int originalIndex ); 98 99 static void setLegendNodePatchShape( QgsLayerTreeLayer *nodeLayer, int originalIndex, const QgsLegendPatchShape &shape ); 100%Docstring 101Sets the legend patch ``shape`` for the legend node belonging to ``nodeLayer`` at the specified ``originalIndex``. 102 103.. seealso:: :py:func:`legendNodePatchShape` 104 105.. versionadded:: 3.14 106%End 107 108 static QgsLegendPatchShape legendNodePatchShape( QgsLayerTreeLayer *nodeLayer, int originalIndex ); 109%Docstring 110Returns the legend patch shape for the legend node belonging to ``nodeLayer`` at the specified ``originalIndex``. 111 112.. seealso:: :py:func:`setLegendNodePatchShape` 113 114.. versionadded:: 3.14 115%End 116 117 static void setLegendNodeSymbolSize( QgsLayerTreeLayer *nodeLayer, int originalIndex, QSizeF size ); 118%Docstring 119Sets the legend symbol ``size`` for the legend node belonging to ``nodeLayer`` at the specified ``originalIndex``. 120 121If either the width or height are non-zero, they will be used when rendering the legend node instead of the default 122symbol width or height from :py:class:`QgsLegendSettings`. 123 124.. seealso:: :py:func:`legendNodeSymbolSize` 125 126.. versionadded:: 3.14 127%End 128 129 static QSizeF legendNodeSymbolSize( QgsLayerTreeLayer *nodeLayer, int originalIndex ); 130%Docstring 131Returns the legend node symbol size for the legend node belonging to ``nodeLayer`` at the specified ``originalIndex``. 132 133If either the width or height are non-zero, they will be used when rendering the legend node instead of the default 134symbol width or height from :py:class:`QgsLegendSettings`. 135 136.. seealso:: :py:func:`setLegendNodeSymbolSize` 137 138.. versionadded:: 3.14 139%End 140 141 static void setLegendNodeCustomSymbol( QgsLayerTreeLayer *nodeLayer, int originalIndex, const QgsSymbol *symbol ); 142%Docstring 143Sets a custom legend ``symbol`` size for the legend node belonging to ``nodeLayer`` at the specified ``originalIndex``. 144 145If ``symbol`` is non-``None``, it will be used in place of the default symbol when rendering 146the legend node. 147 148.. seealso:: :py:func:`legendNodeCustomSymbol` 149 150.. versionadded:: 3.14 151%End 152 153 static QgsSymbol *legendNodeCustomSymbol( QgsLayerTreeLayer *nodeLayer, int originalIndex ) /Factory/; 154%Docstring 155Returns the custom legend symbol for the legend node belonging to ``nodeLayer`` at the specified ``originalIndex``. 156 157If the symbol is non-``None``, it will be used in place of the default symbol when rendering 158the legend node. 159 160Caller takes ownership of the returned symbol. 161 162.. seealso:: :py:func:`setLegendNodeCustomSymbol` 163 164.. versionadded:: 3.14 165%End 166 167 static void setLegendNodeColumnBreak( QgsLayerTreeLayer *nodeLayer, int originalIndex, bool columnBreakBeforeNode ); 168%Docstring 169Sets whether a forced column break should occur before the node. 170 171.. seealso:: :py:func:`legendNodeColumnBreak` 172 173.. versionadded:: 3.14 174%End 175 176 static bool legendNodeColumnBreak( QgsLayerTreeLayer *nodeLayer, int originalIndex ); 177%Docstring 178Returns whether a forced column break should occur before the node. 179 180.. seealso:: :py:func:`setLegendNodeColumnBreak` 181 182.. versionadded:: 3.14 183%End 184 185 static void applyLayerNodeProperties( QgsLayerTreeLayer *nodeLayer, QList<QgsLayerTreeModelLegendNode *> &nodes ); 186%Docstring 187update according to layer node's custom properties (order of items, user labels for items) 188%End 189}; 190 191 192 193 194class QgsDefaultVectorLayerLegend : QgsMapLayerLegend 195{ 196%Docstring 197Default legend implementation for vector layers 198 199.. versionadded:: 2.6 200%End 201 202%TypeHeaderCode 203#include "qgsmaplayerlegend.h" 204%End 205 public: 206 explicit QgsDefaultVectorLayerLegend( QgsVectorLayer *vl ); 207 208 bool textOnSymbolEnabled() const; 209%Docstring 210Returns whether the "text on symbol" functionality is enabled. When enabled, legend symbols 211may have extra text rendered on top. The content of labels and their style is controlled 212by :py:func:`~QgsDefaultVectorLayerLegend.textOnSymbolContent` and :py:func:`~QgsDefaultVectorLayerLegend.textOnSymbolTextFormat`. 213 214.. versionadded:: 3.2 215%End 216 217 void setTextOnSymbolEnabled( bool enabled ); 218%Docstring 219Sets whether the "text on symbol" functionality is enabled. When enabled, legend symbols 220may have extra text rendered on top. The content of labels and their style is controlled 221by :py:func:`~QgsDefaultVectorLayerLegend.textOnSymbolContent` and :py:func:`~QgsDefaultVectorLayerLegend.textOnSymbolTextFormat`. 222 223.. versionadded:: 3.2 224%End 225 226 QgsTextFormat textOnSymbolTextFormat() const; 227%Docstring 228Returns text format of symbol labels for "text on symbol" functionality. 229 230.. versionadded:: 3.2 231%End 232 233 void setTextOnSymbolTextFormat( const QgsTextFormat &format ); 234%Docstring 235Sets text format of symbol labels for "text on symbol" functionality. 236 237.. versionadded:: 3.2 238%End 239 240 QHash<QString, QString> textOnSymbolContent() const; 241%Docstring 242Returns per-symbol content of labels for "text on symbol" functionality. In the passed dictionary 243the keys are rule keys of legend items, the values are labels to be shown. 244 245.. versionadded:: 3.2 246%End 247 248 void setTextOnSymbolContent( const QHash<QString, QString> &content ); 249%Docstring 250Sets per-symbol content of labels for "text on symbol" functionality. In the passed dictionary 251the keys are rule keys of legend items, the values are labels to be shown. 252 253.. versionadded:: 3.2 254%End 255 256 virtual QList<QgsLayerTreeModelLegendNode *> createLayerTreeModelLegendNodes( QgsLayerTreeLayer *nodeLayer ) /Factory/; 257 258 virtual void readXml( const QDomElement &elem, const QgsReadWriteContext &context ); 259 260 virtual QDomElement writeXml( QDomDocument &doc, const QgsReadWriteContext &context ) const; 261 262 263}; 264 265 266class QgsDefaultRasterLayerLegend : QgsMapLayerLegend 267{ 268%Docstring 269Default legend implementation for raster layers 270 271.. versionadded:: 2.6 272%End 273 274%TypeHeaderCode 275#include "qgsmaplayerlegend.h" 276%End 277 public: 278 explicit QgsDefaultRasterLayerLegend( QgsRasterLayer *rl ); 279 280 virtual QList<QgsLayerTreeModelLegendNode *> createLayerTreeModelLegendNodes( QgsLayerTreeLayer *nodeLayer ) /Factory/; 281 282 283}; 284 285 286class QgsDefaultMeshLayerLegend : QgsMapLayerLegend 287{ 288%Docstring 289Default legend implementation for mesh layers 290 291.. versionadded:: 3.4 292%End 293 294%TypeHeaderCode 295#include "qgsmaplayerlegend.h" 296%End 297 public: 298 explicit QgsDefaultMeshLayerLegend( QgsMeshLayer *ml ); 299%Docstring 300Creates an instance for the given mesh layer 301%End 302 303 virtual QList<QgsLayerTreeModelLegendNode *> createLayerTreeModelLegendNodes( QgsLayerTreeLayer *nodeLayer ) /Factory/; 304 305 306}; 307 308 309/************************************************************************ 310 * This file has been generated automatically from * 311 * * 312 * src/core/qgsmaplayerlegend.h * 313 * * 314 * Do not edit manually ! Edit header and run scripts/sipify.pl again * 315 ************************************************************************/ 316