Skip to content

Commit

Permalink
Omit the layer title item completely if the string is empty
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@9641 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Nov 15, 2008
1 parent f67ac34 commit acf0f41
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/core/composer/qgscomposerlegend.cpp
Expand Up @@ -97,14 +97,18 @@ QSizeF QgsComposerLegend::paintAndDetermineSize( QPainter* painter )
currentLayerItem = rootItem->child( i );
if ( currentLayerItem )
{
currentYCoordinate += mLayerSpace;
currentYCoordinate += fontAscentMillimeters( mLayerFont );

//draw layer Item
if ( painter )
{
drawText( painter, mBoxSpace, currentYCoordinate, currentLayerItem->text(), mLayerFont );
}
//Let the user omit the layer title item by having an empty layer title string
if(!currentLayerItem->text().isEmpty())
{
currentYCoordinate += mLayerSpace;
currentYCoordinate += fontAscentMillimeters( mLayerFont );

//draw layer Item
if ( painter )
{
drawText( painter, mBoxSpace, currentYCoordinate, currentLayerItem->text(), mLayerFont );
}
}

maxXCoord = std::max( maxXCoord, 2 * mBoxSpace + textWidthMillimeters( mLayerFont, currentLayerItem->text() ) );

Expand Down

0 comments on commit acf0f41

Please sign in to comment.