QGIS API Documentation 4.1.0-Master (01362494303)
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
187 {
188 Q_NOWARN_DEPRECATED_PUSH //because of deprecated members
190 = default;
192
196 QPainter *painter = nullptr;
197
202 Q_DECL_DEPRECATED QPointF point;
203
208 Q_DECL_DEPRECATED double labelXOffset = 0.0;
209
214 double top = 0.0;
215
222 double columnLeft = 0.0;
223
230 double columnRight = 0.0;
231
238
245
253 QSizeF patchSize;
254
261
268
275 };
276
278 {
280 QSizeF labelSize;
281 };
282
287 virtual ItemMetrics draw( const QgsLegendSettings &settings, ItemContext &ctx );
288
296 QJsonObject exportToJson( const QgsLegendSettings &settings, const QgsRenderContext &context );
297
305 virtual QSizeF drawSymbol( const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight ) const;
306
313 virtual QJsonObject exportSymbolToJson( const QgsLegendSettings &settings, const QgsRenderContext &context ) const;
314
322 virtual QSizeF drawSymbolText( const QgsLegendSettings &settings, ItemContext *ctx, QSizeF symbolSize ) const;
323
324#ifdef SIP_RUN
325 // clang-format off
326 SIP_PYOBJECT __repr__();
327 % MethodCode
328 QString str = u"<QgsLayerTreeModelLegendNode: \"%1\">"_s.arg( sipCpp->data( Qt::DisplayRole ).toString() );
329 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
330 % End
331// clang-format on
332#endif
333
334 public slots :
335
342 void checkAllItems();
343
350 void uncheckAllItems();
351
358 void toggleAllItems();
359
360 signals:
363
370
371 protected:
373 explicit QgsLayerTreeModelLegendNode( QgsLayerTreeLayer *nodeL, QObject *parent SIP_TRANSFERTHIS = nullptr );
374
377
378 protected:
380 bool mEmbeddedInParent = false;
381 QString mUserLabel;
383 QSizeF mUserSize;
385
386 private:
391 void checkAll( bool state );
392};
394
395#include "qgslegendsymbolitem.h"
396#include "qgstextformat.h"
397
405{
406 Q_OBJECT
407
408 public:
409 static double MINIMUM_SIZE;
410 static double MAXIMUM_SIZE;
411
412#ifndef SIP_RUN
415#endif
416
423 QgsSymbolLegendNode( QgsLayerTreeLayer *nodeLayer, const QgsLegendSymbolItem &item, QObject *parent SIP_TRANSFERTHIS = nullptr );
425
426 Qt::ItemFlags flags() const override;
427 QVariant data( int role ) const override;
428 bool setData( const QVariant &value, int role ) override;
429
430 QSizeF drawSymbol( const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight ) const override;
431
432 QJsonObject exportSymbolToJson( const QgsLegendSettings &settings, const QgsRenderContext &context ) const override;
433
434 void setEmbeddedInParent( bool embedded ) override;
435
436 void setUserLabel( const QString &userLabel ) override
437 {
439 updateLabel();
440 }
441
442 bool isScaleOK( double scale ) const override { return mItem.isScaleOK( scale ); }
443
444 void invalidateMapBasedData() override;
445
449 void setIconSize( QSize sz );
450 QSize iconSize() const { return mIconSize; }
451
458 QSize minimumIconSize() const;
459
465 QSize minimumIconSize( QgsRenderContext *context ) const;
466
471 const QgsSymbol *symbol() const;
472
479 void setSymbol( QgsSymbol *symbol SIP_TRANSFER );
480
485 QString textOnSymbolLabel() const { return mTextOnSymbolLabel; }
486
491 void setTextOnSymbolLabel( const QString &label ) { mTextOnSymbolLabel = label; }
492
497 QgsTextFormat textOnSymbolTextFormat() const { return mTextOnSymbolTextFormat; }
498
503 void setTextOnSymbolTextFormat( const QgsTextFormat &format ) { mTextOnSymbolTextFormat = format; }
504
509 QString symbolLabel() const;
510
517 QgsLegendPatchShape patchShape() const;
518
525 void setPatchShape( const QgsLegendPatchShape &shape );
526
536 QgsSymbol *customSymbol() const;
537
549 void setCustomSymbol( QgsSymbol *symbol SIP_TRANSFER );
550
557 QString evaluateLabel( const QgsExpressionContext &context = QgsExpressionContext(), const QString &label = QString() );
558
566 QgsExpressionContextScope *createSymbolScope() const SIP_FACTORY;
567
568#ifdef SIP_RUN
569 // clang-format off
570 SIP_PYOBJECT __repr__();
571 % MethodCode
572 QString str = u"<QgsSymbolLegendNode: %1 \"%2\""_s.arg(
573 sipCpp->data( static_cast< int >( QgsLayerTreeModelLegendNode::CustomRole::RuleKey ) ).toString(),
574 sipCpp->data( Qt::DisplayRole ).toString() );
575 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
576 % End
577// clang-format on
578#endif
579
580 // clang-format off
581 private:
582 // clang-format on
583 void updateLabel();
584
585 private:
587 mutable QPixmap mPixmap; // cached symbol preview
588 QString mLabel;
589 bool mSymbolUsesMapUnits = false;
590
591 QSize mIconSize;
592
593 QString mTextOnSymbolLabel;
594 QgsTextFormat mTextOnSymbolTextFormat;
595
596 std::unique_ptr< QgsSymbol > mCustomSymbol;
597
598 // ident the symbol icon to make it look like a tree structure
599 static const int INDENT_SIZE = 20;
600};
601
602
609{
610 Q_OBJECT
611
612 public:
621 QgsSimpleLegendNode( QgsLayerTreeLayer *nodeLayer, const QString &label, const QIcon &icon = QIcon(), QObject *parent SIP_TRANSFERTHIS = nullptr, const QString &key = QString() );
622
623 QVariant data( int role ) const override;
624
625#ifdef SIP_RUN
626 // clang-format off
627 SIP_PYOBJECT __repr__();
628 % MethodCode
629 QString str = u"<QgsSimpleLegendNode: \"%1\">"_s.arg( sipCpp->data( Qt::DisplayRole ).toString() );
630 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
631 % End
632// clang-format on
633#endif
634
635 // clang-format off
636 private:
637 // clang-format on
638 QString mLabel;
639 QString mId;
640 QIcon mIcon;
641 QString mKey;
642};
643
644
650{
651 Q_OBJECT
652
653 public:
660 QgsImageLegendNode( QgsLayerTreeLayer *nodeLayer, const QImage &img, QObject *parent SIP_TRANSFERTHIS = nullptr );
661
662 QVariant data( int role ) const override;
663
664 QSizeF drawSymbol( const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight ) const override;
665
666 QJsonObject exportSymbolToJson( const QgsLegendSettings &settings, const QgsRenderContext &context ) const override;
667
668#ifdef SIP_RUN
669 // clang-format off
670 SIP_PYOBJECT __repr__();
671 % MethodCode
672 QString str = u"<QgsImageLegendNode: \"%1\">"_s.arg( sipCpp->data( Qt::DisplayRole ).toString() );
673 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
674 % End
675// clang-format on
676#endif
677
678 // clang-format off
679 private:
680 // clang-format on
681 QImage mImage;
682};
683
690{
691 Q_OBJECT
692
693 public:
705 QgsLayerTreeLayer *nodeLayer,
706 const QColor &color,
707 const QString &label,
708 QObject *parent SIP_TRANSFERTHIS = nullptr,
709 bool isCheckable = false,
710 const QString &ruleKey = QString(),
711 const QString &parentRuleKey = QString()
712 );
713
714 Qt::ItemFlags flags() const override;
715 QVariant data( int role ) const override;
716 bool setData( const QVariant &value, int role ) override;
717 QSizeF drawSymbol( const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight ) const override;
718 QJsonObject exportSymbolToJson( const QgsLegendSettings &settings, const QgsRenderContext &context ) const override;
719
725 QString ruleKey() const { return mRuleKey; }
726
732 bool isCheckable() const { return mCheckable; }
733
734#ifdef SIP_RUN
735 // clang-format off
736 SIP_PYOBJECT __repr__();
737 % MethodCode
738 QString str = u"<QgsRasterSymbolLegendNode: \"%1\">"_s.arg( sipCpp->data( Qt::DisplayRole ).toString() );
739 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
740 % End
741// clang-format on
742#endif
743
744 // clang-format off
745 private:
746 // clang-format on
747 QColor mColor;
748 QString mLabel;
749 bool mCheckable = false;
750 QString mRuleKey;
751 QString mParentRuleKey;
752};
753
754class QgsImageFetcher;
755
762{
763 Q_OBJECT
764
765 public:
771 QgsWmsLegendNode( QgsLayerTreeLayer *nodeLayer, QObject *parent SIP_TRANSFERTHIS = nullptr );
772
774
775 QVariant data( int role ) const override;
776
777 QSizeF drawSymbol( const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight ) const override;
778
779 QJsonObject exportSymbolToJson( const QgsLegendSettings &settings, const QgsRenderContext &context ) const override;
780
781 void invalidateMapBasedData() override;
782
787 QImage getLegendGraphicBlocking() const;
788
789
790#ifdef SIP_RUN
791 // clang-format off
792 SIP_PYOBJECT __repr__();
793 % MethodCode
794 QString str = u"<QgsWmsLegendNode: \"%1\">"_s.arg( sipCpp->data( Qt::DisplayRole ).toString() );
795 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
796 % End
797// clang-format on
798#endif
799
800 // clang-format off
801 private slots:
802 // clang-format on
803
804 void getLegendGraphicFinished( const QImage & );
805 void getLegendGraphicErrored( const QString & );
806 void getLegendGraphicProgress( qint64, qint64 );
807
808 private:
809 // Lazy loading of the image
810 QImage getLegendGraphic( bool synchronous = false ) const;
811
812 QImage renderMessage( const QString &msg ) const;
813
814 QImage mImage;
815
816 bool mValid = false;
817
818 mutable std::unique_ptr<QgsImageFetcher> mFetcher;
819};
820
821
827{
828 Q_OBJECT
829
830 public:
832 QgsDataDefinedSizeLegendNode( QgsLayerTreeLayer *nodeLayer, const QgsDataDefinedSizeLegend &settings, QObject *parent SIP_TRANSFERTHIS = nullptr );
834
835 QVariant data( int role ) const override;
836
837 ItemMetrics draw( const QgsLegendSettings &settings, ItemContext &ctx ) override;
838
839#ifdef SIP_RUN
840 // clang-format off
841 SIP_PYOBJECT __repr__();
842 % MethodCode
843 QString str = u"<QgsDataDefinedSizeLegendNode: \"%1\">"_s.arg( sipCpp->data( Qt::DisplayRole ).toString() );
844 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
845 % End
846// clang-format on
847#endif
848
849 // clang-format off
850 private:
851 // clang-format on
852 void cacheImage() const;
853 std::unique_ptr<QgsDataDefinedSizeLegend> mSettings;
854 mutable QImage mImage;
855};
856
863{
864 Q_OBJECT
865 public:
872 QgsVectorLabelLegendNode( QgsLayerTreeLayer *nodeLayer, const QgsPalLayerSettings &labelSettings, QObject *parent = nullptr );
873 ~QgsVectorLabelLegendNode() override;
874
880 QVariant data( int role ) const override;
881
889 QSizeF drawSymbol( const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight ) const override;
890
897 QJsonObject exportSymbolToJson( const QgsLegendSettings &settings, const QgsRenderContext &context ) const override;
898
899#ifdef SIP_RUN
900 // clang-format off
901 SIP_PYOBJECT __repr__();
902 % MethodCode
903 QString str = u"<QgsVectorLabelLegendNode: \"%1\">"_s.arg( sipCpp->data( Qt::DisplayRole ).toString() );
904 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
905 % End
906// clang-format on
907#endif
908
909 // clang-format off
910 private:
911 // clang-format on
912 QgsPalLayerSettings mLabelSettings;
913 QSizeF drawSymbol( const QgsLegendSettings &settings, const QgsRenderContext &renderContext, double xOffset = 0.0, double yOffset = 0.0 ) const;
914 void textWidthHeight( double &width, double &height, QgsRenderContext &ctx, const QgsTextFormat &textFormat, const QStringList &textLines ) const;
915};
916
917
918#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.
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 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:7666
#define Q_NOWARN_DEPRECATED_PUSH
Definition qgis.h:7665
#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: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.