@@ -63,9 +63,20 @@ class CORE_EXPORT QgsLegendRenderer
63
63
*/
64
64
void drawLegend ( QPainter *painter );
65
65
66
+ /* *
67
+ * Draw the legend using a given QgsRenderContext. It willoccupy the area reported in legendSize().
68
+ */
66
69
void drawLegend ( QgsRenderContext *rendercontext );
67
70
71
+ /* *
72
+ * Set the style of a QgsLayerTreeNode,
73
+ * This class requires a node and a style to apply to the node
74
+ */
68
75
static void setNodeLegendStyle ( QgsLayerTreeNode *node, QgsLegendStyle::Style style );
76
+
77
+ /* *
78
+ * Returns the style of a given QgsLayerTreeNode in a given QgsLayerTreeModel
79
+ */
69
80
static QgsLegendStyle::Style nodeLegendStyle ( QgsLayerTreeNode *node, QgsLayerTreeModel *model );
70
81
71
82
private:
@@ -114,6 +125,11 @@ class CORE_EXPORT QgsLegendRenderer
114
125
int column = 0 ;
115
126
};
116
127
128
+ /* *
129
+ * displays the legend and return the size of said legend.
130
+ * If the painter is null, only the size will be given,
131
+ * since a painter is needed to render the legend.
132
+ */
117
133
QSizeF paintAndDetermineSize ( QPainter *painter = nullptr );
118
134
119
135
// ! Create list of atoms according to current layer splitting mode
@@ -136,9 +152,15 @@ class CORE_EXPORT QgsLegendRenderer
136
152
* style top space */
137
153
QSizeF drawAtom ( const Atom &atom, QPainter *painter = nullptr , QPointF point = QPointF() );
138
154
155
+ /* *
156
+ * Displays the symbol of a given QgsLayerTreeModelLegendNode
157
+ */
139
158
Nucleon drawSymbolItem ( QgsLayerTreeModelLegendNode *symbolItem, QPainter *painter = nullptr , QPointF point = QPointF(), double labelXOffset = 0 );
140
159
141
- // ! Draws a layer item
160
+ /* *
161
+ * Displays the title of a layer given the QgsLayerTreeLayer, a painter and QPointF
162
+ * otherwise return the size the of the title
163
+ */
142
164
QSizeF drawLayerTitle ( QgsLayerTreeLayer *nodeLayer, QPainter *painter = nullptr , QPointF point = QPointF() );
143
165
144
166
/* *
@@ -147,16 +169,33 @@ class CORE_EXPORT QgsLegendRenderer
147
169
*/
148
170
QSizeF drawGroupTitle ( QgsLayerTreeGroup *nodeGroup, QPainter *painter = nullptr , QPointF point = QPointF() );
149
171
150
-
172
+ /* *
173
+ * displays the legend and return the size of said legend.
174
+ * If QgsRenderContext is null, only the size will be given.
175
+ */
151
176
QSizeF paintAndDetermineSize ( QgsRenderContext *rendercontext );
152
177
178
+ /* *
179
+ * Draws title in the legend using the title font and the specified alignment
180
+ * If no rendercontext is specified, function returns the required width/height to draw the title.
181
+ */
153
182
QSizeF drawTitle ( QgsRenderContext *rendercontext, QPointF point = QPointF(), Qt::AlignmentFlag halignment = Qt::AlignLeft, double legendWidth = 0 );
154
183
184
+ /* *
185
+ * Draw atom and return its actual size, the atom is drawn with the space above it
186
+ * so that first atoms in column are all aligned to the same line regardles their
187
+ * style top space */
155
188
QSizeF drawAtom ( const Atom &atom, QgsRenderContext *rendercontext, QPointF point = QPointF() );
156
189
190
+ /* *
191
+ * Displays the symbol of a given QgsLayerTreeModelLegendNode
192
+ */
157
193
Nucleon drawSymbolItem ( QgsLayerTreeModelLegendNode *symbolItem, QgsRenderContext *rendercontext, QPointF point = QPointF(), double labelXOffset = 0 );
158
194
159
- // ! Draws a layer item
195
+ /* *
196
+ * Displays the title of a layer given the QgsLayerTreeLayer, a rendercontext and QPointF
197
+ * otherwise return the size the of the title
198
+ */
160
199
QSizeF drawLayerTitle ( QgsLayerTreeLayer *nodeLayer, QgsRenderContext *rendercontext, QPointF point = QPointF() );
161
200
162
201
/* *
@@ -165,6 +204,9 @@ class CORE_EXPORT QgsLegendRenderer
165
204
*/
166
205
QSizeF drawGroupTitle ( QgsLayerTreeGroup *nodeGroup, QgsRenderContext *rendercontext, QPointF point = QPointF() );
167
206
207
+ /* *
208
+ * Returns the style of a given QgsLayerTreeNode
209
+ */
168
210
QgsLegendStyle::Style nodeLegendStyle ( QgsLayerTreeNode *node );
169
211
170
212
private:
0 commit comments