[QGIS Commit] r13493 - trunk/qgis/src/core/composer
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Sat May 15 11:37:35 EDT 2010
Author: mhugent
Date: 2010-05-15 11:37:35 -0400 (Sat, 15 May 2010)
New Revision: 13493
Modified:
trunk/qgis/src/core/composer/qgscomposerlegend.cpp
Log:
Fix minimum size of composer legend
Modified: trunk/qgis/src/core/composer/qgscomposerlegend.cpp
===================================================================
--- trunk/qgis/src/core/composer/qgscomposerlegend.cpp 2010-05-15 15:04:56 UTC (rev 13492)
+++ trunk/qgis/src/core/composer/qgscomposerlegend.cpp 2010-05-15 15:37:35 UTC (rev 13493)
@@ -117,6 +117,19 @@
currentYCoordinate += mBoxSpace;
+ size.setHeight( currentYCoordinate );
+ size.setWidth( maxXCoord );
+
+ //adjust box if width or height is to small
+ if ( painter && currentYCoordinate > rect().height() )
+ {
+ setSceneRect( QRectF( transform().dx(), transform().dy(), rect().width(), currentYCoordinate ) );
+ }
+ if ( painter && maxXCoord > rect().width() )
+ {
+ setSceneRect( QRectF( transform().dx(), transform().dy(), maxXCoord, rect().height() ) );
+ }
+
if ( painter )
{
painter->restore();
@@ -129,19 +142,6 @@
}
}
- size.setHeight( currentYCoordinate );
- size.setWidth( maxXCoord );
-
- //adjust box if width or height is to small
- if ( painter && currentYCoordinate > rect().width() )
- {
- setSceneRect( QRectF( transform().dx(), transform().dy(), rect().width(), currentYCoordinate ) );
- }
- if ( painter && maxXCoord > rect().height() )
- {
- setSceneRect( QRectF( transform().dx(), transform().dy(), maxXCoord, rect().height() ) );
- }
-
return size;
}
@@ -295,9 +295,11 @@
{
p->setPen( QColor( 0, 0, 0 ) );
drawText( p, currentXCoord, currentYCoord + fontAscentMillimeters( mItemFont ) + ( realItemHeight - fontAscentMillimeters( mItemFont ) ) / 2, currentItem->text(), mItemFont );
+ currentXCoord += textWidthMillimeters( mItemFont, currentItem->text() );
}
+ currentXCoord += mBoxSpace;
- maxXCoord = std::max( maxXCoord, currentXCoord + textWidthMillimeters( mItemFont, currentItem->text() ) + mBoxSpace );
+ maxXCoord = std::max( maxXCoord, currentXCoord );
currentYCoord += realItemHeight;
}
More information about the QGIS-commit
mailing list