@@ -94,6 +94,14 @@ Entry point called from QgsLegendRenderer to do the rendering.
94
94
Default implementation calls drawSymbol() and drawSymbolText() methods.
95
95
96
96
If ctx is ``None``, this is just first stage when preparing layout - without actual rendering.
97
+ %End
98
+
99
+ void draw( const QgsLegendSettings &settings, QJsonObject &json );
100
+ %Docstring
101
+ Entry point called from QgsLegendRenderer to do the rendering in a \a
102
+ json object.
103
+
104
+ .. versionadded:: 3.8
97
105
%End
98
106
99
107
virtual QSizeF drawSymbol( const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight ) const;
@@ -105,6 +113,17 @@ Draws symbol on the left side of the item
105
113
:param itemHeight: Minimal height of the legend item - used for correct positioning when rendering
106
114
107
115
:return: Real size of the symbol (may be bigger than "normal" symbol size from settings)
116
+ %End
117
+
118
+ virtual void drawSymbol( const QgsLegendSettings &settings, QJsonObject &json ) const;
119
+ %Docstring
120
+ Adds a symbol in base64 string within the ``json`` object with the key
121
+ "icon".
122
+
123
+ :param settings: Legend layout configuration
124
+ :param json: The json object to update
125
+
126
+ .. versionadded:: 3.8
108
127
%End
109
128
110
129
virtual QSizeF drawSymbolText( const QgsLegendSettings &settings, ItemContext *ctx, QSizeF symbolSize ) const;
@@ -116,6 +135,16 @@ Draws label on the right side of the item
116
135
:param symbolSize: Real size of the associated symbol - used for correct positioning when rendering
117
136
118
137
:return: Size of the label (may span multiple lines)
138
+ %End
139
+
140
+ void drawSymbolText( const QgsLegendSettings &settings, QJsonObject &json ) const;
141
+ %Docstring
142
+ Adds a label in the ``json`` object with the key "title".
143
+
144
+ :param settings: Legend layout configuration
145
+ :param json: The json object to update
146
+
147
+ .. versionadded:: 3.8
119
148
%End
120
149
121
150
signals:
@@ -172,6 +201,9 @@ Constructor for QgsSymbolLegendNode.
172
201
virtual QSizeF drawSymbol( const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight ) const;
173
202
174
203
204
+ virtual void drawSymbol( const QgsLegendSettings &settings, QJsonObject &json ) const;
205
+
206
+
175
207
virtual void setEmbeddedInParent( bool embedded );
176
208
177
209
@@ -358,6 +390,9 @@ Constructor for QgsImageLegendNode.
358
390
virtual QSizeF drawSymbol( const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight ) const;
359
391
360
392
393
+ virtual void drawSymbol( const QgsLegendSettings &settings, QJsonObject &json ) const;
394
+
395
+
361
396
};
362
397
363
398
class QgsRasterSymbolLegendNode : QgsLayerTreeModelLegendNode
@@ -389,6 +424,9 @@ Constructor for QgsRasterSymbolLegendNode.
389
424
virtual QSizeF drawSymbol( const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight ) const;
390
425
391
426
427
+ virtual void drawSymbol( const QgsLegendSettings &settings, QJsonObject &json ) const;
428
+
429
+
392
430
};
393
431
394
432
@@ -419,6 +457,9 @@ Constructor for QgsWmsLegendNode.
419
457
virtual QSizeF drawSymbol( const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight ) const;
420
458
421
459
460
+ virtual void drawSymbol( const QgsLegendSettings &settings, QJsonObject &json ) const;
461
+
462
+
422
463
virtual void invalidateMapBasedData();
423
464
424
465
0 commit comments