Skip to content

Commit 2fab80e

Browse files
roya0045nyalldawson
authored andcommittedJan 10, 2019
adding barebone documentation
1 parent f2290fc commit 2fab80e

File tree

1 file changed

+45
-3
lines changed

1 file changed

+45
-3
lines changed
 

‎src/core/qgslegendrenderer.h

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,20 @@ class CORE_EXPORT QgsLegendRenderer
6363
*/
6464
void drawLegend( QPainter *painter );
6565

66+
/**
67+
* Draw the legend using a given QgsRenderContext. It willoccupy the area reported in legendSize().
68+
*/
6669
void drawLegend( QgsRenderContext *rendercontext );
6770

71+
/**
72+
* Set the style of a QgsLayerTreeNode,
73+
* This class requires a node and a style to apply to the node
74+
*/
6875
static void setNodeLegendStyle( QgsLayerTreeNode *node, QgsLegendStyle::Style style );
76+
77+
/**
78+
* Returns the style of a given QgsLayerTreeNode in a given QgsLayerTreeModel
79+
*/
6980
static QgsLegendStyle::Style nodeLegendStyle( QgsLayerTreeNode *node, QgsLayerTreeModel *model );
7081

7182
private:
@@ -114,6 +125,11 @@ class CORE_EXPORT QgsLegendRenderer
114125
int column = 0;
115126
};
116127

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+
*/
117133
QSizeF paintAndDetermineSize( QPainter *painter = nullptr );
118134

119135
//! Create list of atoms according to current layer splitting mode
@@ -136,9 +152,15 @@ class CORE_EXPORT QgsLegendRenderer
136152
* style top space */
137153
QSizeF drawAtom( const Atom &atom, QPainter *painter = nullptr, QPointF point = QPointF() );
138154

155+
/**
156+
* Displays the symbol of a given QgsLayerTreeModelLegendNode
157+
*/
139158
Nucleon drawSymbolItem( QgsLayerTreeModelLegendNode *symbolItem, QPainter *painter = nullptr, QPointF point = QPointF(), double labelXOffset = 0 );
140159

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+
*/
142164
QSizeF drawLayerTitle( QgsLayerTreeLayer *nodeLayer, QPainter *painter = nullptr, QPointF point = QPointF() );
143165

144166
/**
@@ -147,16 +169,33 @@ class CORE_EXPORT QgsLegendRenderer
147169
*/
148170
QSizeF drawGroupTitle( QgsLayerTreeGroup *nodeGroup, QPainter *painter = nullptr, QPointF point = QPointF() );
149171

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+
*/
151176
QSizeF paintAndDetermineSize( QgsRenderContext *rendercontext );
152177

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+
*/
153182
QSizeF drawTitle( QgsRenderContext *rendercontext, QPointF point = QPointF(), Qt::AlignmentFlag halignment = Qt::AlignLeft, double legendWidth = 0 );
154183

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 */
155188
QSizeF drawAtom( const Atom &atom, QgsRenderContext *rendercontext, QPointF point = QPointF() );
156189

190+
/**
191+
* Displays the symbol of a given QgsLayerTreeModelLegendNode
192+
*/
157193
Nucleon drawSymbolItem( QgsLayerTreeModelLegendNode *symbolItem, QgsRenderContext *rendercontext, QPointF point = QPointF(), double labelXOffset = 0 );
158194

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+
*/
160199
QSizeF drawLayerTitle( QgsLayerTreeLayer *nodeLayer, QgsRenderContext *rendercontext, QPointF point = QPointF() );
161200

162201
/**
@@ -165,6 +204,9 @@ class CORE_EXPORT QgsLegendRenderer
165204
*/
166205
QSizeF drawGroupTitle( QgsLayerTreeGroup *nodeGroup, QgsRenderContext *rendercontext, QPointF point = QPointF() );
167206

207+
/**
208+
* Returns the style of a given QgsLayerTreeNode
209+
*/
168210
QgsLegendStyle::Style nodeLegendStyle( QgsLayerTreeNode *node );
169211

170212
private:

0 commit comments

Comments
 (0)
Please sign in to comment.