Skip to content

Commit

Permalink
composer legend single column box width fix
Browse files Browse the repository at this point in the history
  • Loading branch information
blazek committed Nov 17, 2012
1 parent 2ddc753 commit 724f190
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/core/composer/qgscomposerlegend.cpp
Expand Up @@ -301,7 +301,9 @@ QgsComposerLegend::LegendSize QgsComposerLegend::paintAndDetermineSize( QPainter
{
double currentYCoord = mBoxSpace;

// center if we stay in totalWidth, otherwise allign to left and expand total width
// For multicolumn center if we stay in totalWidth, otherwise allign to left
// and expand total width. With single column keep alligned to left be cause
// it looks better alligned with items bellow instead of centered
Qt::AlignmentFlag halignement;
if ( mColumnCount > 1 && currentPosition.titleSize.width() + 2 * mBoxSpace < totalWidth )
{
Expand All @@ -310,7 +312,7 @@ QgsComposerLegend::LegendSize QgsComposerLegend::paintAndDetermineSize( QPainter
else
{
halignement = Qt::AlignLeft;
totalWidth = currentPosition.titleSize.width() + 2 * mBoxSpace;
totalWidth = qMax( currentPosition.titleSize.width() + 2 * mBoxSpace, totalWidth );
}

if ( painter ) painter->setPen( QColor( 0, 0, 0 ) );
Expand Down

0 comments on commit 724f190

Please sign in to comment.