QGIS API Documentation 4.1.0-Master (0cdd3ae6384)
Loading...
Searching...
No Matches
qgslayertreemodellegendnode.h
Go to the documentation of this file.
1/***************************************************************************
2 qgslayertreemodellegendnode.h
3 --------------------------------------
4 Date : August 2014
5 Copyright : (C) 2014 by Martin Dobias
6 Email : wonder dot sk at gmail dot com
7
8 QgsWMSLegendNode : Sandro Santilli < strk at keybit dot net >
9
10 ***************************************************************************
11 * *
12 * This program is free software; you can redistribute it and/or modify *
13 * it under the terms of the GNU General Public License as published by *
14 * the Free Software Foundation; either version 2 of the License, or *
15 * (at your option) any later version. *
16 * *
17 ***************************************************************************/
18
19#ifndef QGSLAYERTREEMODELLEGENDNODE_H
20#define QGSLAYERTREEMODELLEGENDNODE_H
21
22#include "qgis_core.h"
23#include "qgis_sip.h"
25#include "qgslegendpatchshape.h"
26#include "qgspallabeling.h"
27
28#include <QIcon>
29#include <QObject>
30#include <QString>
31
32using namespace Qt::StringLiterals;
33
37class QgsMapSettings;
38class QgsSymbol;
41class QgsTextFormat;
42class QgsTextDocument;
44
53class CORE_EXPORT QgsLayerTreeModelLegendNode : public QObject
54{
55 //SIP_TYPEHEADER_INCLUDE( "qgscolorramplegendnode.h" );
56
57#ifdef SIP_RUN
59 if ( qobject_cast<QgsSymbolLegendNode *>( sipCpp ) )
60 sipType = sipType_QgsSymbolLegendNode;
61 else if ( qobject_cast<QgsDataDefinedSizeLegendNode *>( sipCpp ) )
62 sipType = sipType_QgsDataDefinedSizeLegendNode;
63 else if ( qobject_cast<QgsImageLegendNode *>( sipCpp ) )
64 sipType = sipType_QgsImageLegendNode;
65 else if ( qobject_cast<QgsRasterSymbolLegendNode *>( sipCpp ) )
66 sipType = sipType_QgsRasterSymbolLegendNode;
67 else if ( qobject_cast<QgsSimpleLegendNode *>( sipCpp ) )
68 sipType = sipType_QgsSimpleLegendNode;
69 else if ( qobject_cast<QgsWmsLegendNode *>( sipCpp ) )
70 sipType = sipType_QgsWmsLegendNode;
71 else if ( qobject_cast<QgsColorRampLegendNode *>( sipCpp ) )
72 sipType = sipType_QgsColorRampLegendNode;
73 else
74 sipType = 0;
76#endif
77
78 // clang-format off
79 Q_OBJECT
80
81 public:
82
83 // *INDENT-OFF*
84
92 {
93 RuleKey SIP_MONKEYPATCH_COMPAT_NAME( RuleKeyRole ) = Qt::UserRole,
94 ParentRuleKey SIP_MONKEYPATCH_COMPAT_NAME( ParentRuleKeyRole ),
95 NodeType SIP_MONKEYPATCH_COMPAT_NAME( NodeTypeRole ),
96 IsDataDefinedSize SIP_MONKEYPATCH_COMPAT_NAME( IsDataDefinedSizeRole ),
97 };
98 Q_ENUM( CustomRole )
99 // clang-format on
100 // *INDENT-ON*
101
102
114
117
119 QgsLayerTreeModel *model() const;
120
122 virtual Qt::ItemFlags flags() const;
123
125 virtual QVariant data( int role ) const = 0;
126
128 virtual bool setData( const QVariant &value, int role );
129
130 virtual bool isEmbeddedInParent() const { return mEmbeddedInParent; }
131 virtual void setEmbeddedInParent( bool embedded ) { mEmbeddedInParent = embedded; }
132
133 virtual QString userLabel() const { return mUserLabel; }
134 virtual void setUserLabel( const QString &userLabel ) { mUserLabel = userLabel; }
135
145 virtual QSizeF userPatchSize() const;
146
156 virtual void setUserPatchSize( QSizeF size );
157
164 virtual void setColumnBreak( bool breakBeforeNode ) { mColumnBreakBeforeNode = breakBeforeNode; }
165
172 virtual bool columnBreak() const { return mColumnBreakBeforeNode; }
173
174 virtual bool isScaleOK( double scale ) const
175 {
176 Q_UNUSED( scale )
177 return true;
178 }
179
184 virtual void invalidateMapBasedData() {}
185
193 virtual void invalidateDisplayData() {}
194
196 {
197 Q_NOWARN_DEPRECATED_PUSH //because of deprecated members
199 = default;
201
205 QPainter *painter = nullptr;
206
211 Q_DECL_DEPRECATED QPointF point;
212
217 Q_DECL_DEPRECATED double labelXOffset = 0.0;
218
223 double top = 0.0;
224
231 double columnLeft = 0.0;
232
239 double columnRight = 0.0;
240
247
254
262 QSizeF patchSize;
263
270
277
284 };
285
287 {
289 QSizeF labelSize;
290 };
291
296 virtual ItemMetrics draw( const QgsLegendSettings &settings, ItemContext &ctx );
297
305 QJsonObject exportToJson( const QgsLegendSettings &settings, const QgsRenderContext &context );
306
314 virtual QSizeF drawSymbol( const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight ) const;
315
322 virtual QJsonObject exportSymbolToJson( const QgsLegendSettings &settings, const QgsRenderContext &context ) const;
323
331 virtual QSizeF drawSymbolText( const QgsLegendSettings &settings, ItemContext *ctx, QSizeF symbolSize ) const;
332
333#ifdef SIP_RUN
334 // clang-format off
335 SIP_PYOBJECT __repr__();
336 % MethodCode
337 QString str = u"<QgsLayerTreeModelLegendNode: \"%1\">"_s.arg( sipCpp->data( Qt::DisplayRole ).toString() );
338 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
339 % End
340// clang-format on
341#endif
342
343 public slots :
344
351 void checkAllItems();
352
359 void uncheckAllItems();
360
367 void toggleAllItems();
368
369 signals:
372
379
380 protected:
382 explicit QgsLayerTreeModelLegendNode( QgsLayerTreeLayer *nodeL, QObject *parent SIP_TRANSFERTHIS = nullptr );
383
386
387 protected:
389 bool mEmbeddedInParent = false;
390 QString mUserLabel;
392 QSizeF mUserSize;
394
395 private:
400 void checkAll( bool state );
401};
403
404#include "qgslegendsymbolitem.h"
405#include "qgstextformat.h"
406
414{
415 Q_OBJECT
416
417 public:
418 static double MINIMUM_SIZE;
419 static double MAXIMUM_SIZE;
420
421#ifndef SIP_RUN
424#endif
425
432 QgsSymbolLegendNode( QgsLayerTreeLayer *nodeLayer, const QgsLegendSymbolItem &item, QObject *parent SIP_TRANSFERTHIS = nullptr );
434
435 Qt::ItemFlags flags() const override;
436 QVariant data( int role ) const override;
437 bool setData( const QVariant &value, int role ) override;
438 void invalidateDisplayData() override;
439 QSizeF drawSymbol( const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight ) const override;
440
441 QJsonObject exportSymbolToJson( const QgsLegendSettings &settings, const QgsRenderContext &context ) const override;
442
443 void setEmbeddedInParent( bool embedded ) override;
444
445 void setUserLabel( const QString &userLabel ) override
446 {
448 updateLabel();
449 }
450
451 bool isScaleOK( double scale ) const override { return mItem.isScaleOK( scale ); }
452
453 void invalidateMapBasedData() override;
454
458 void setIconSize( QSize sz );
459 QSize iconSize() const { return mIconSize; }
460
467 QSize minimumIconSize() const;
468
474 QSize minimumIconSize( QgsRenderContext *context ) const;
475
480 const QgsSymbol *symbol() const;
481
488 void setSymbol( QgsSymbol *symbol SIP_TRANSFER );
489
494 QString textOnSymbolLabel() const { return mTextOnSymbolLabel; }
495
500 void setTextOnSymbolLabel( const QString &label ) { mTextOnSymbolLabel = label; }
501
506 QgsTextFormat textOnSymbolTextFormat() const { return mTextOnSymbolTextFormat; }
507
512 void setTextOnSymbolTextFormat( const QgsTextFormat &format ) { mTextOnSymbolTextFormat = format; }
513
518 QString symbolLabel() const;
519
526 QgsLegendPatchShape patchShape() const;
527
534 void setPatchShape( const QgsLegendPatchShape &shape );
535
545 QgsSymbol *customSymbol() const;
546
558 void setCustomSymbol( QgsSymbol *symbol SIP_TRANSFER );
559
566 QString evaluateLabel( const QgsExpressionContext &context = QgsExpressionContext(), const QString &label = QString() );
567
575 QgsExpressionContextScope *createSymbolScope() const SIP_FACTORY;
576
577#ifdef SIP_RUN
578 // clang-format off
579 SIP_PYOBJECT __repr__();
580 % MethodCode
581 QString str = u"<QgsSymbolLegendNode: %1 \"%2\""_s.arg(
582 sipCpp->data( static_cast< int >( QgsLayerTreeModelLegendNode::CustomRole::RuleKey ) ).toString(),
583 sipCpp->data( Qt::DisplayRole ).toString() );
584 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
585 % End
586// clang-format on
587#endif
588
589 // clang-format off
590 private:
591 // clang-format on
592 void updateLabel();
593
594 private:
596 mutable QPixmap mPixmap; // cached symbol preview
597 QString mLabel;
598 bool mSymbolUsesMapUnits = false;
599
600 QSize mIconSize;
601
602 QString mTextOnSymbolLabel;
603 QgsTextFormat mTextOnSymbolTextFormat;
604
605 std::unique_ptr< QgsSymbol > mCustomSymbol;
606
607 // ident the symbol icon to make it look like a tree structure
608 static const int INDENT_SIZE = 20;
609};
610
611
618{
619 Q_OBJECT
620
621 public:
630 QgsSimpleLegendNode( QgsLayerTreeLayer *nodeLayer, const QString &label, const QIcon &icon = QIcon(), QObject *parent SIP_TRANSFERTHIS = nullptr, const QString &key = QString() );
631
632 QVariant data( int role ) const override;
633
634#ifdef SIP_RUN
635 // clang-format off
636 SIP_PYOBJECT __repr__();
637 % MethodCode
638 QString str = u"<QgsSimpleLegendNode: \"%1\">"_s.arg( sipCpp->data( Qt::DisplayRole ).toString() );
639 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
640 % End
641// clang-format on
642#endif
643
644 // clang-format off
645 private:
646 // clang-format on
647 QString mLabel;
648 QString mId;
649 QIcon mIcon;
650 QString mKey;
651};
652
653
659{
660 Q_OBJECT
661
662 public:
669 QgsImageLegendNode( QgsLayerTreeLayer *nodeLayer, const QImage &img, QObject *parent SIP_TRANSFERTHIS = nullptr );
670
671 QVariant data( int role ) const override;
672
673 QSizeF drawSymbol( const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight ) const override;
674
675 QJsonObject exportSymbolToJson( const QgsLegendSettings &settings, const QgsRenderContext &context ) const override;
676
677#ifdef SIP_RUN
678 // clang-format off
679 SIP_PYOBJECT __repr__();
680 % MethodCode
681 QString str = u"<QgsImageLegendNode: \"%1\">"_s.arg( sipCpp->data( Qt::DisplayRole ).toString() );
682 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
683 % End
684// clang-format on
685#endif
686
687 // clang-format off
688 private:
689 // clang-format on
690 QImage mImage;
691};
692
699{
700 Q_OBJECT
701
702 public:
714 QgsLayerTreeLayer *nodeLayer,
715 const QColor &color,
716 const QString &label,
717 QObject *parent SIP_TRANSFERTHIS = nullptr,
718 bool isCheckable = false,
719 const QString &ruleKey = QString(),
720 const QString &parentRuleKey = QString()
721 );
722
723 Qt::ItemFlags flags() const override;
724 QVariant data( int role ) const override;
725 bool setData( const QVariant &value, int role ) override;
726 QSizeF drawSymbol( const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight ) const override;
727 QJsonObject exportSymbolToJson( const QgsLegendSettings &settings, const QgsRenderContext &context ) const override;
728
734 QString ruleKey() const { return mRuleKey; }
735
741 bool isCheckable() const { return mCheckable; }
742
743#ifdef SIP_RUN
744 // clang-format off
745 SIP_PYOBJECT __repr__();
746 % MethodCode
747 QString str = u"<QgsRasterSymbolLegendNode: \"%1\">"_s.arg( sipCpp->data( Qt::DisplayRole ).toString() );
748 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
749 % End
750// clang-format on
751#endif
752
753 // clang-format off
754 private:
755 // clang-format on
756 QColor mColor;
757 QString mLabel;
758 bool mCheckable = false;
759 QString mRuleKey;
760 QString mParentRuleKey;
761};
762
763class QgsImageFetcher;
764
771{
772 Q_OBJECT
773
774 public:
780 QgsWmsLegendNode( QgsLayerTreeLayer *nodeLayer, QObject *parent SIP_TRANSFERTHIS = nullptr );
781
783
784 QVariant data( int role ) const override;
785
786 QSizeF drawSymbol( const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight ) const override;
787
788 QJsonObject exportSymbolToJson( const QgsLegendSettings &settings, const QgsRenderContext &context ) const override;
789
790 void invalidateMapBasedData() override;
791
796 QImage getLegendGraphicBlocking() const;
797
798
799#ifdef SIP_RUN
800 // clang-format off
801 SIP_PYOBJECT __repr__();
802 % MethodCode
803 QString str = u"<QgsWmsLegendNode: \"%1\">"_s.arg( sipCpp->data( Qt::DisplayRole ).toString() );
804 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
805 % End
806// clang-format on
807#endif
808
809 // clang-format off
810 private slots:
811 // clang-format on
812
813 void getLegendGraphicFinished( const QImage & );
814 void getLegendGraphicErrored( const QString & );
815 void getLegendGraphicProgress( qint64, qint64 );
816
817 private:
818 // Lazy loading of the image
819 QImage getLegendGraphic( bool synchronous = false ) const;
820
821 QImage renderMessage( const QString &msg ) const;
822
823 QImage mImage;
824
825 bool mValid = false;
826
827 mutable std::unique_ptr<QgsImageFetcher> mFetcher;
828};
829
830
836{
837 Q_OBJECT
838
839 public:
841 QgsDataDefinedSizeLegendNode( QgsLayerTreeLayer *nodeLayer, const QgsDataDefinedSizeLegend &settings, QObject *parent SIP_TRANSFERTHIS = nullptr );
843
844 QVariant data( int role ) const override;
845 void invalidateDisplayData() override;
846 ItemMetrics draw( const QgsLegendSettings &settings, ItemContext &ctx ) override;
847
848#ifdef SIP_RUN
849 // clang-format off
850 SIP_PYOBJECT __repr__();
851 % MethodCode
852 QString str = u"<QgsDataDefinedSizeLegendNode: \"%1\">"_s.arg( sipCpp->data( Qt::DisplayRole ).toString() );
853 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
854 % End
855// clang-format on
856#endif
857
858 // clang-format off
859 private:
860 // clang-format on
861 void cacheImage() const;
862 std::unique_ptr<QgsDataDefinedSizeLegend> mSettings;
863 mutable QImage mImage;
864};
865
872{
873 Q_OBJECT
874 public:
881 QgsVectorLabelLegendNode( QgsLayerTreeLayer *nodeLayer, const QgsPalLayerSettings &labelSettings, QObject *parent = nullptr );
882 ~QgsVectorLabelLegendNode() override;
883
889 QVariant data( int role ) const override;
890
898 QSizeF drawSymbol( const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight ) const override;
899
906 QJsonObject exportSymbolToJson( const QgsLegendSettings &settings, const QgsRenderContext &context ) const override;
907
908#ifdef SIP_RUN
909 // clang-format off
910 SIP_PYOBJECT __repr__();
911 % MethodCode
912 QString str = u"<QgsVectorLabelLegendNode: \"%1\">"_s.arg( sipCpp->data( Qt::DisplayRole ).toString() );
913 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
914 % End
915// clang-format on
916#endif
917
918 // clang-format off
919 private:
920 // clang-format on
921 QgsPalLayerSettings mLabelSettings;
922 QSizeF drawSymbol( const QgsLegendSettings &settings, const QgsRenderContext &renderContext, double xOffset = 0.0, double yOffset = 0.0 ) const;
923 void textWidthHeight( double &width, double &height, QgsRenderContext &ctx, const QgsTextFormat &textFormat, const QStringList &textLines ) const;
924};
925
926
927#endif // QGSLAYERTREEMODELLEGENDNODE_H
QgsDataDefinedSizeLegendNode(QgsLayerTreeLayer *nodeLayer, const QgsDataDefinedSizeLegend &settings, QObject *parent=nullptr)
Construct the node using QgsDataDefinedSizeLegend as definition of the node's appearance.
ItemMetrics draw(const QgsLegendSettings &settings, ItemContext &ctx) override
Entry point called from QgsLegendRenderer to do the rendering.
QVariant data(int role) const override
Returns data associated with the item. Must be implemented in derived class.
void invalidateDisplayData() override
Invalidates cached display data for the node.
Object that keeps configuration of appearance of marker symbol's data-defined size in legend.
Single scope for storing variables and functions for use within a QgsExpressionContext.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
QVariant data(int role) const override
Returns data associated with the item. Must be implemented in derived class.
QgsImageLegendNode(QgsLayerTreeLayer *nodeLayer, const QImage &img, QObject *parent=nullptr)
Constructor for QgsImageLegendNode.
QSizeF drawSymbol(const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight) const override
Draws symbol on the left side of the item.
QJsonObject exportSymbolToJson(const QgsLegendSettings &settings, const QgsRenderContext &context) const override
Adds a symbol in base64 string within a JSON object with the key "icon".
Layer tree node points to a map layer.
virtual QVariant data(int role) const =0
Returns data associated with the item. Must be implemented in derived class.
QJsonObject exportToJson(const QgsLegendSettings &settings, const QgsRenderContext &context)
Entry point called from QgsLegendRenderer to do the rendering in a JSON object.
virtual bool columnBreak() const
Returns whether a forced column break should occur before the node.
@ SimpleLegend
Simple label with icon legend node type.
@ RasterSymbolLegend
Raster symbol legend node type.
@ ImageLegend
Raster image legend node type.
@ DataDefinedSizeLegend
Marker symbol legend node type.
@ EmbeddedWidget
Embedded widget placeholder node type.
@ SymbolLegend
Vector symbol legend node type.
void checkAllItems()
Checks all checkable items belonging to the same layer as this node.
void uncheckAllItems()
Unchecks all checkable items belonging to the same layer as this node.
virtual bool isScaleOK(double scale) const
virtual void setColumnBreak(bool breakBeforeNode)
Sets whether a forced column break should occur before the node.
QgsLayerTreeModelLegendNode(QgsLayerTreeLayer *nodeL, QObject *parent=nullptr)
Construct the node with pointer to its parent layer node.
virtual void invalidateMapBasedData()
Notification from model that information from associated map view has changed.
void sizeChanged()
Emitted when the size of this node changes.
virtual ItemMetrics draw(const QgsLegendSettings &settings, ItemContext &ctx)
Entry point called from QgsLegendRenderer to do the rendering.
void dataChanged()
Emitted on internal data change so the layer tree model can forward the signal to views.
QgsRenderContext * createTemporaryRenderContext() const
Returns a temporary context or nullptr if legendMapViewData are not valid.
virtual QJsonObject exportSymbolToJson(const QgsLegendSettings &settings, const QgsRenderContext &context) const
Adds a symbol in base64 string within a JSON object with the key "icon".
void toggleAllItems()
Toggle all checkable items belonging to the same layer as this node.
QgsLayerTreeLayer * layerNode() const
Returns pointer to the parent layer node.
virtual void invalidateDisplayData()
Invalidates cached display data for the node.
virtual QSizeF drawSymbol(const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight) const
Draws symbol on the left side of the item.
virtual void setEmbeddedInParent(bool embedded)
virtual void setUserLabel(const QString &userLabel)
virtual bool setData(const QVariant &value, int role)
Sets some data associated with the item. Default implementation does nothing and returns false.
virtual QSizeF drawSymbolText(const QgsLegendSettings &settings, ItemContext *ctx, QSizeF symbolSize) const
Draws label on the right side of the item.
A model representing the layer tree, including layers and groups of layers.
Represents a patch shape for use in map legends.
Stores the appearance and layout settings for legend drawing with QgsLegendRenderer.
Stores information about one class/rule of a vector layer renderer in a unified way that can be used ...
Contains configuration for rendering maps.
Contains settings for how a map layer will be labeled.
Qt::ItemFlags flags() const override
Returns item flags associated with the item. Default implementation returns Qt::ItemIsEnabled.
bool setData(const QVariant &value, int role) override
Sets some data associated with the item. Default implementation does nothing and returns false.
QString ruleKey() const
Returns the unique identifier of node for identification of the item within renderer.
QJsonObject exportSymbolToJson(const QgsLegendSettings &settings, const QgsRenderContext &context) const override
Adds a symbol in base64 string within a JSON object with the key "icon".
QgsRasterSymbolLegendNode(QgsLayerTreeLayer *nodeLayer, const QColor &color, const QString &label, QObject *parent=nullptr, bool isCheckable=false, const QString &ruleKey=QString(), const QString &parentRuleKey=QString())
Constructor for QgsRasterSymbolLegendNode.
QVariant data(int role) const override
Returns data associated with the item. Must be implemented in derived class.
bool isCheckable() const
Returns whether the item is user-checkable - whether renderer supports enabling/disabling it.
QSizeF drawSymbol(const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight) const override
Draws symbol on the left side of the item.
Contains information about the context of a rendering operation.
Stores properties relating to a screen.
A double settings entry.
QVariant data(int role) const override
Returns data associated with the item. Must be implemented in derived class.
QgsSimpleLegendNode(QgsLayerTreeLayer *nodeLayer, const QString &label, const QIcon &icon=QIcon(), QObject *parent=nullptr, const QString &key=QString())
Constructor for QgsSimpleLegendNode.
QString textOnSymbolLabel() const
Returns label of text to be shown on top of the symbol.
QgsSymbolLegendNode(QgsLayerTreeLayer *nodeLayer, const QgsLegendSymbolItem &item, QObject *parent=nullptr)
Constructor for QgsSymbolLegendNode.
void setUserLabel(const QString &userLabel) override
static const QgsSettingsEntryDouble * settingsLegendSymbolMaximumSize
void setTextOnSymbolTextFormat(const QgsTextFormat &format)
Sets format of text to be shown on top of the symbol.
void setTextOnSymbolLabel(const QString &label)
Sets label of text to be shown on top of the symbol.
~QgsSymbolLegendNode() override
QSizeF drawSymbol(const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight) const override
Draws symbol on the left side of the item.
bool setData(const QVariant &value, int role) override
Sets some data associated with the item. Default implementation does nothing and returns false.
Qt::ItemFlags flags() const override
Returns item flags associated with the item. Default implementation returns Qt::ItemIsEnabled.
bool isScaleOK(double scale) const override
void invalidateDisplayData() override
Invalidates cached display data for the node.
void setEmbeddedInParent(bool embedded) override
QVariant data(int role) const override
Returns data associated with the item. Must be implemented in derived class.
static const QgsSettingsEntryDouble * settingsLegendSymbolMinimumSize
QJsonObject exportSymbolToJson(const QgsLegendSettings &settings, const QgsRenderContext &context) const override
Adds a symbol in base64 string within a JSON object with the key "icon".
QgsTextFormat textOnSymbolTextFormat() const
Returns text format of the label to be shown on top of the symbol.
Abstract base class for all rendered symbols.
Definition qgssymbol.h:227
Contains pre-calculated metrics of a QgsTextDocument.
Represents a document consisting of one or more QgsTextBlock objects.
Container for all settings relating to text rendering.
QgsVectorLabelLegendNode(QgsLayerTreeLayer *nodeLayer, const QgsPalLayerSettings &labelSettings, QObject *parent=nullptr)
QgsVectorLabelLegendNode.
QSizeF drawSymbol(const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight) const override
drawSymbol
QJsonObject exportSymbolToJson(const QgsLegendSettings &settings, const QgsRenderContext &context) const override
exportSymbolToJson
QVariant data(int role) const override
data Returns data associated with the item
QImage getLegendGraphicBlocking() const
Fetches the image from the server and returns it.
QSizeF drawSymbol(const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight) const override
Draws symbol on the left side of the item.
void invalidateMapBasedData() override
Notification from model that information from associated map view has changed.
QVariant data(int role) const override
Returns data associated with the item. Must be implemented in derived class.
~QgsWmsLegendNode() override
QgsWmsLegendNode(QgsLayerTreeLayer *nodeLayer, QObject *parent=nullptr)
Constructor for QgsWmsLegendNode.
QJsonObject exportSymbolToJson(const QgsLegendSettings &settings, const QgsRenderContext &context) const override
Adds a symbol in base64 string within a JSON object with the key "icon".
#define Q_NOWARN_DEPRECATED_POP
Definition qgis.h:7938
#define Q_NOWARN_DEPRECATED_PUSH
Definition qgis.h:7937
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition qgis_sip.h:198
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:52
#define SIP_SKIP
Definition qgis_sip.h:133
#define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS, FORMERNAME)
Definition qgis_sip.h:265
#define SIP_TRANSFER
Definition qgis_sip.h:35
#define SIP_FACTORY
Definition qgis_sip.h:83
#define SIP_END
Definition qgis_sip.h:215
#define SIP_MONKEYPATCH_COMPAT_NAME(FORMERNAME)
Definition qgis_sip.h:267
Q_DECLARE_METATYPE(QgsDatabaseQueryLogEntry)
Q_NOWARN_DEPRECATED_PUSH ItemContext()=default
Q_DECL_DEPRECATED double labelXOffset
Offset from the left side where label should start.
QgsLegendPatchShape patchShape
The patch shape to render for the node.
QgsScreenProperties screenProperties
Destination screen properties.
double maxSiblingSymbolWidth
Largest symbol width, considering all other sibling legend components associated with the current com...
QSizeF patchSize
Symbol patch size to render for the node.
const QgsTextDocument * textDocument
Optional text document.
double columnLeft
Left side of current legend column.
const QgsTextDocumentMetrics * textDocumentMetrics
Optional text document metrics.
double columnRight
Right side of current legend column.
Q_DECL_DEPRECATED QPointF point
Top-left corner of the legend item.
Q_NOWARN_DEPRECATED_POP QgsRenderContext * context
Render context, if available.