QGIS API Documentation 4.0.0-Norrköping (1ddcee3d0e4)
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;
40class QgsTextFormat;
41class QgsTextDocument;
43
52class CORE_EXPORT QgsLayerTreeModelLegendNode : public QObject
53{
54 //SIP_TYPEHEADER_INCLUDE( "qgscolorramplegendnode.h" );
55
56#ifdef SIP_RUN
58 if ( qobject_cast<QgsSymbolLegendNode *>( sipCpp ) )
59 sipType = sipType_QgsSymbolLegendNode;
60 else if ( qobject_cast<QgsDataDefinedSizeLegendNode *>( sipCpp ) )
61 sipType = sipType_QgsDataDefinedSizeLegendNode;
62 else if ( qobject_cast<QgsImageLegendNode *>( sipCpp ) )
63 sipType = sipType_QgsImageLegendNode;
64 else if ( qobject_cast<QgsRasterSymbolLegendNode *>( sipCpp ) )
65 sipType = sipType_QgsRasterSymbolLegendNode;
66 else if ( qobject_cast<QgsSimpleLegendNode *>( sipCpp ) )
67 sipType = sipType_QgsSimpleLegendNode;
68 else if ( qobject_cast<QgsWmsLegendNode *>( sipCpp ) )
69 sipType = sipType_QgsWmsLegendNode;
70 else if ( qobject_cast<QgsColorRampLegendNode *>( sipCpp ) )
71 sipType = sipType_QgsColorRampLegendNode;
72 else
73 sipType = 0;
75#endif
76
77 // clang-format off
78 Q_OBJECT
79
80 public:
81
82 // *INDENT-OFF*
83
91 {
92 RuleKey SIP_MONKEYPATCH_COMPAT_NAME( RuleKeyRole ) = Qt::UserRole,
93 ParentRuleKey SIP_MONKEYPATCH_COMPAT_NAME( ParentRuleKeyRole ),
94 NodeType SIP_MONKEYPATCH_COMPAT_NAME( NodeTypeRole ),
95 IsDataDefinedSize SIP_MONKEYPATCH_COMPAT_NAME( IsDataDefinedSizeRole ),
96 };
97 Q_ENUM( CustomRole )
98 // clang-format on
99 // *INDENT-ON*
100
101
113
116
118 QgsLayerTreeModel *model() const;
119
121 virtual Qt::ItemFlags flags() const;
122
124 virtual QVariant data( int role ) const = 0;
125
127 virtual bool setData( const QVariant &value, int role );
128
129 virtual bool isEmbeddedInParent() const { return mEmbeddedInParent; }
130 virtual void setEmbeddedInParent( bool embedded ) { mEmbeddedInParent = embedded; }
131
132 virtual QString userLabel() const { return mUserLabel; }
133 virtual void setUserLabel( const QString &userLabel ) { mUserLabel = userLabel; }
134
144 virtual QSizeF userPatchSize() const;
145
155 virtual void setUserPatchSize( QSizeF size );
156
163 virtual void setColumnBreak( bool breakBeforeNode ) { mColumnBreakBeforeNode = breakBeforeNode; }
164
171 virtual bool columnBreak() const { return mColumnBreakBeforeNode; }
172
173 virtual bool isScaleOK( double scale ) const
174 {
175 Q_UNUSED( scale )
176 return true;
177 }
178
183 virtual void invalidateMapBasedData() {}
184
186 {
187 Q_NOWARN_DEPRECATED_PUSH //because of deprecated members
189 = default;
191
195 QPainter *painter = nullptr;
196
201 Q_DECL_DEPRECATED QPointF point;
202
207 Q_DECL_DEPRECATED double labelXOffset = 0.0;
208
213 double top = 0.0;
214
221 double columnLeft = 0.0;
222
229 double columnRight = 0.0;
230
237
244
252 QSizeF patchSize;
253
260
267
274 };
275
277 {
279 QSizeF labelSize;
280 };
281
286 virtual ItemMetrics draw( const QgsLegendSettings &settings, ItemContext &ctx );
287
295 QJsonObject exportToJson( const QgsLegendSettings &settings, const QgsRenderContext &context );
296
304 virtual QSizeF drawSymbol( const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight ) const;
305
312 virtual QJsonObject exportSymbolToJson( const QgsLegendSettings &settings, const QgsRenderContext &context ) const;
313
321 virtual QSizeF drawSymbolText( const QgsLegendSettings &settings, ItemContext *ctx, QSizeF symbolSize ) const;
322
323#ifdef SIP_RUN
324 // clang-format off
325 SIP_PYOBJECT __repr__();
326 % MethodCode
327 QString str = u"<QgsLayerTreeModelLegendNode: \"%1\">"_s.arg( sipCpp->data( Qt::DisplayRole ).toString() );
328 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
329 % End
330// clang-format on
331#endif
332
333 public slots :
334
341 void checkAllItems();
342
349 void uncheckAllItems();
350
357 void toggleAllItems();
358
359 signals:
362
369
370 protected:
372 explicit QgsLayerTreeModelLegendNode( QgsLayerTreeLayer *nodeL, QObject *parent SIP_TRANSFERTHIS = nullptr );
373
376
377 protected:
379 bool mEmbeddedInParent = false;
380 QString mUserLabel;
382 QSizeF mUserSize;
384
385 private:
390 void checkAll( bool state );
391};
393
394#include "qgslegendsymbolitem.h"
395#include "qgstextformat.h"
396
404{
405 Q_OBJECT
406
407 public:
408 static double MINIMUM_SIZE;
409 static double MAXIMUM_SIZE;
410
417 QgsSymbolLegendNode( QgsLayerTreeLayer *nodeLayer, const QgsLegendSymbolItem &item, QObject *parent SIP_TRANSFERTHIS = nullptr );
419
420 Qt::ItemFlags flags() const override;
421 QVariant data( int role ) const override;
422 bool setData( const QVariant &value, int role ) override;
423
424 QSizeF drawSymbol( const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight ) const override;
425
426 QJsonObject exportSymbolToJson( const QgsLegendSettings &settings, const QgsRenderContext &context ) const override;
427
428 void setEmbeddedInParent( bool embedded ) override;
429
430 void setUserLabel( const QString &userLabel ) override
431 {
433 updateLabel();
434 }
435
436 bool isScaleOK( double scale ) const override { return mItem.isScaleOK( scale ); }
437
438 void invalidateMapBasedData() override;
439
443 void setIconSize( QSize sz );
444 QSize iconSize() const { return mIconSize; }
445
452 QSize minimumIconSize() const;
453
459 QSize minimumIconSize( QgsRenderContext *context ) const;
460
465 const QgsSymbol *symbol() const;
466
473 void setSymbol( QgsSymbol *symbol SIP_TRANSFER );
474
479 QString textOnSymbolLabel() const { return mTextOnSymbolLabel; }
480
485 void setTextOnSymbolLabel( const QString &label ) { mTextOnSymbolLabel = label; }
486
491 QgsTextFormat textOnSymbolTextFormat() const { return mTextOnSymbolTextFormat; }
492
497 void setTextOnSymbolTextFormat( const QgsTextFormat &format ) { mTextOnSymbolTextFormat = format; }
498
503 QString symbolLabel() const;
504
511 QgsLegendPatchShape patchShape() const;
512
519 void setPatchShape( const QgsLegendPatchShape &shape );
520
530 QgsSymbol *customSymbol() const;
531
543 void setCustomSymbol( QgsSymbol *symbol SIP_TRANSFER );
544
551 QString evaluateLabel( const QgsExpressionContext &context = QgsExpressionContext(), const QString &label = QString() );
552
560 QgsExpressionContextScope *createSymbolScope() const SIP_FACTORY;
561
562#ifdef SIP_RUN
563 // clang-format off
564 SIP_PYOBJECT __repr__();
565 % MethodCode
566 QString str = u"<QgsSymbolLegendNode: %1 \"%2\""_s.arg(
567 sipCpp->data( static_cast< int >( QgsLayerTreeModelLegendNode::CustomRole::RuleKey ) ).toString(),
568 sipCpp->data( Qt::DisplayRole ).toString() );
569 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
570 % End
571// clang-format on
572#endif
573
574 // clang-format off
575 private:
576 // clang-format on
577 void updateLabel();
578
579 private:
581 mutable QPixmap mPixmap; // cached symbol preview
582 QString mLabel;
583 bool mSymbolUsesMapUnits = false;
584
585 QSize mIconSize;
586
587 QString mTextOnSymbolLabel;
588 QgsTextFormat mTextOnSymbolTextFormat;
589
590 std::unique_ptr< QgsSymbol > mCustomSymbol;
591
592 // ident the symbol icon to make it look like a tree structure
593 static const int INDENT_SIZE = 20;
594};
595
596
603{
604 Q_OBJECT
605
606 public:
615 QgsSimpleLegendNode( QgsLayerTreeLayer *nodeLayer, const QString &label, const QIcon &icon = QIcon(), QObject *parent SIP_TRANSFERTHIS = nullptr, const QString &key = QString() );
616
617 QVariant data( int role ) const override;
618
619#ifdef SIP_RUN
620 // clang-format off
621 SIP_PYOBJECT __repr__();
622 % MethodCode
623 QString str = u"<QgsSimpleLegendNode: \"%1\">"_s.arg( sipCpp->data( Qt::DisplayRole ).toString() );
624 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
625 % End
626// clang-format on
627#endif
628
629 // clang-format off
630 private:
631 // clang-format on
632 QString mLabel;
633 QString mId;
634 QIcon mIcon;
635 QString mKey;
636};
637
638
644{
645 Q_OBJECT
646
647 public:
654 QgsImageLegendNode( QgsLayerTreeLayer *nodeLayer, const QImage &img, QObject *parent SIP_TRANSFERTHIS = nullptr );
655
656 QVariant data( int role ) const override;
657
658 QSizeF drawSymbol( const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight ) const override;
659
660 QJsonObject exportSymbolToJson( const QgsLegendSettings &settings, const QgsRenderContext &context ) const override;
661
662#ifdef SIP_RUN
663 // clang-format off
664 SIP_PYOBJECT __repr__();
665 % MethodCode
666 QString str = u"<QgsImageLegendNode: \"%1\">"_s.arg( sipCpp->data( Qt::DisplayRole ).toString() );
667 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
668 % End
669// clang-format on
670#endif
671
672 // clang-format off
673 private:
674 // clang-format on
675 QImage mImage;
676};
677
684{
685 Q_OBJECT
686
687 public:
699 QgsLayerTreeLayer *nodeLayer,
700 const QColor &color,
701 const QString &label,
702 QObject *parent SIP_TRANSFERTHIS = nullptr,
703 bool isCheckable = false,
704 const QString &ruleKey = QString(),
705 const QString &parentRuleKey = QString()
706 );
707
708 Qt::ItemFlags flags() const override;
709 QVariant data( int role ) const override;
710 bool setData( const QVariant &value, int role ) override;
711 QSizeF drawSymbol( const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight ) const override;
712 QJsonObject exportSymbolToJson( const QgsLegendSettings &settings, const QgsRenderContext &context ) const override;
713
719 QString ruleKey() const { return mRuleKey; }
720
726 bool isCheckable() const { return mCheckable; }
727
728#ifdef SIP_RUN
729 // clang-format off
730 SIP_PYOBJECT __repr__();
731 % MethodCode
732 QString str = u"<QgsRasterSymbolLegendNode: \"%1\">"_s.arg( sipCpp->data( Qt::DisplayRole ).toString() );
733 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
734 % End
735// clang-format on
736#endif
737
738 // clang-format off
739 private:
740 // clang-format on
741 QColor mColor;
742 QString mLabel;
743 bool mCheckable = false;
744 QString mRuleKey;
745 QString mParentRuleKey;
746};
747
748class QgsImageFetcher;
749
756{
757 Q_OBJECT
758
759 public:
765 QgsWmsLegendNode( QgsLayerTreeLayer *nodeLayer, QObject *parent SIP_TRANSFERTHIS = nullptr );
766
768
769 QVariant data( int role ) const override;
770
771 QSizeF drawSymbol( const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight ) const override;
772
773 QJsonObject exportSymbolToJson( const QgsLegendSettings &settings, const QgsRenderContext &context ) const override;
774
775 void invalidateMapBasedData() override;
776
781 QImage getLegendGraphicBlocking() const;
782
783
784#ifdef SIP_RUN
785 // clang-format off
786 SIP_PYOBJECT __repr__();
787 % MethodCode
788 QString str = u"<QgsWmsLegendNode: \"%1\">"_s.arg( sipCpp->data( Qt::DisplayRole ).toString() );
789 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
790 % End
791// clang-format on
792#endif
793
794 // clang-format off
795 private slots:
796 // clang-format on
797
798 void getLegendGraphicFinished( const QImage & );
799 void getLegendGraphicErrored( const QString & );
800 void getLegendGraphicProgress( qint64, qint64 );
801
802 private:
803 // Lazy loading of the image
804 QImage getLegendGraphic( bool synchronous = false ) const;
805
806 QImage renderMessage( const QString &msg ) const;
807
808 QImage mImage;
809
810 bool mValid = false;
811
812 mutable std::unique_ptr<QgsImageFetcher> mFetcher;
813};
814
815
821{
822 Q_OBJECT
823
824 public:
826 QgsDataDefinedSizeLegendNode( QgsLayerTreeLayer *nodeLayer, const QgsDataDefinedSizeLegend &settings, QObject *parent SIP_TRANSFERTHIS = nullptr );
828
829 QVariant data( int role ) const override;
830
831 ItemMetrics draw( const QgsLegendSettings &settings, ItemContext &ctx ) override;
832
833#ifdef SIP_RUN
834 // clang-format off
835 SIP_PYOBJECT __repr__();
836 % MethodCode
837 QString str = u"<QgsDataDefinedSizeLegendNode: \"%1\">"_s.arg( sipCpp->data( Qt::DisplayRole ).toString() );
838 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
839 % End
840// clang-format on
841#endif
842
843 // clang-format off
844 private:
845 // clang-format on
846 void cacheImage() const;
847 std::unique_ptr<QgsDataDefinedSizeLegend> mSettings;
848 mutable QImage mImage;
849};
850
857{
858 Q_OBJECT
859 public:
866 QgsVectorLabelLegendNode( QgsLayerTreeLayer *nodeLayer, const QgsPalLayerSettings &labelSettings, QObject *parent = nullptr );
867 ~QgsVectorLabelLegendNode() override;
868
874 QVariant data( int role ) const override;
875
883 QSizeF drawSymbol( const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight ) const override;
884
891 QJsonObject exportSymbolToJson( const QgsLegendSettings &settings, const QgsRenderContext &context ) const override;
892
893#ifdef SIP_RUN
894 // clang-format off
895 SIP_PYOBJECT __repr__();
896 % MethodCode
897 QString str = u"<QgsVectorLabelLegendNode: \"%1\">"_s.arg( sipCpp->data( Qt::DisplayRole ).toString() );
898 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
899 % End
900// clang-format on
901#endif
902
903 // clang-format off
904 private:
905 // clang-format on
906 QgsPalLayerSettings mLabelSettings;
907 QSizeF drawSymbol( const QgsLegendSettings &settings, const QgsRenderContext &renderContext, double xOffset = 0.0, double yOffset = 0.0 ) const;
908 void textWidthHeight( double &width, double &height, QgsRenderContext &ctx, const QgsTextFormat &textFormat, const QStringList &textLines ) const;
909};
910
911
912#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.
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 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.
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
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 setEmbeddedInParent(bool embedded) override
QVariant data(int role) const override
Returns data associated with the item. Must be implemented in derived class.
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:7504
#define Q_NOWARN_DEPRECATED_PUSH
Definition qgis.h:7503
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition qgis_sip.h:198
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:52
#define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS, FORMERNAME)
Definition qgis_sip.h:267
#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:269
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.