@@ -95,38 +95,38 @@ QSizeF QgsComposerLegend::paintAndDetermineSize( QPainter* painter )
95
95
// draw only visible layer items
96
96
QgsMapRenderer* theMapRenderer = mComposition ->mapRenderer ();
97
97
QStringList visibleLayerIds;
98
- if ( theMapRenderer)
99
- {
100
- visibleLayerIds = theMapRenderer->layerSet ();
101
- }
102
-
98
+ if ( theMapRenderer )
99
+ {
100
+ visibleLayerIds = theMapRenderer->layerSet ();
101
+ }
102
+
103
103
104
104
for ( int i = 0 ; i < numLayerItems; ++i )
105
105
{
106
106
currentLayerItem = rootItem->child ( i );
107
107
if ( currentLayerItem )
108
108
{
109
109
QString currentLayerId = currentLayerItem->data ().toString ();
110
- if ( visibleLayerIds.contains (currentLayerId) )
111
- {
112
- // Let the user omit the layer title item by having an empty layer title string
113
- if ( !currentLayerItem->text ().isEmpty ())
114
- {
115
- currentYCoordinate += mLayerSpace ;
116
- currentYCoordinate += fontAscentMillimeters ( mLayerFont );
117
-
118
- // draw layer Item
119
- if ( painter )
120
- {
121
- drawText ( painter, mBoxSpace , currentYCoordinate, currentLayerItem->text (), mLayerFont );
122
- }
123
- }
124
-
125
- maxXCoord = std::max ( maxXCoord, 2 * mBoxSpace + textWidthMillimeters ( mLayerFont , currentLayerItem->text () ) );
126
-
127
- // and child items
128
- drawLayerChildItems ( painter, currentLayerItem, currentYCoordinate, maxXCoord );
129
- }
110
+ if ( visibleLayerIds.contains ( currentLayerId ) )
111
+ {
112
+ // Let the user omit the layer title item by having an empty layer title string
113
+ if ( !currentLayerItem->text ().isEmpty () )
114
+ {
115
+ currentYCoordinate += mLayerSpace ;
116
+ currentYCoordinate += fontAscentMillimeters ( mLayerFont );
117
+
118
+ // draw layer Item
119
+ if ( painter )
120
+ {
121
+ drawText ( painter, mBoxSpace , currentYCoordinate, currentLayerItem->text (), mLayerFont );
122
+ }
123
+ }
124
+
125
+ maxXCoord = std::max ( maxXCoord, 2 * mBoxSpace + textWidthMillimeters ( mLayerFont , currentLayerItem->text () ) );
126
+
127
+ // and child items
128
+ drawLayerChildItems ( painter, currentLayerItem, currentYCoordinate, maxXCoord );
129
+ }
130
130
}
131
131
}
132
132
@@ -148,15 +148,15 @@ QSizeF QgsComposerLegend::paintAndDetermineSize( QPainter* painter )
148
148
size.setWidth ( maxXCoord );
149
149
150
150
// adjust box if width or height is to small
151
- if ( painter && currentYCoordinate > rect ().width ())
152
- {
153
- setSceneRect ( QRectF ( transform ().dx (), transform ().dy (), rect ().width (), currentYCoordinate) );
154
- }
155
- if ( painter && maxXCoord > rect ().height ())
156
- {
157
- setSceneRect ( QRectF ( transform ().dx (), transform ().dy (), maxXCoord, rect ().height ()) );
158
- }
159
-
151
+ if ( painter && currentYCoordinate > rect ().width () )
152
+ {
153
+ setSceneRect ( QRectF ( transform ().dx (), transform ().dy (), rect ().width (), currentYCoordinate ) );
154
+ }
155
+ if ( painter && maxXCoord > rect ().height () )
156
+ {
157
+ setSceneRect ( QRectF ( transform ().dx (), transform ().dy (), maxXCoord, rect ().height () ) );
158
+ }
159
+
160
160
return size;
161
161
}
162
162
@@ -402,7 +402,7 @@ void QgsComposerLegend::updateLegend()
402
402
update ();
403
403
}
404
404
405
- bool QgsComposerLegend::writeXML ( QDomElement& elem, QDomDocument & doc )
405
+ bool QgsComposerLegend::writeXML ( QDomElement& elem, QDomDocument & doc ) const
406
406
{
407
407
if ( elem.isNull () )
408
408
{
0 commit comments