Skip to content

Commit 724f190

Browse files
committed
composer legend single column box width fix
1 parent 2ddc753 commit 724f190

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/core/composer/qgscomposerlegend.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,9 @@ QgsComposerLegend::LegendSize QgsComposerLegend::paintAndDetermineSize( QPainter
301301
{
302302
double currentYCoord = mBoxSpace;
303303

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

316318
if ( painter ) painter->setPen( QColor( 0, 0, 0 ) );

0 commit comments

Comments
 (0)