Skip to content

Commit 856341d

Browse files
committedAug 11, 2014
[composer] Prevent data defined size of scalebar from being less than calculated minimum size
1 parent ad799c8 commit 856341d

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed
 

‎src/core/composer/qgscomposerscalebar.cpp

100755100644
Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,19 @@ void QgsComposerScaleBar::adjustBoxSize()
385385
QRectF box = mStyle->calculateBoxSize();
386386

387387
//update rect for data defined size and position
388-
setSceneRect( evalItemRect( box ) );
388+
QRectF newRect = evalItemRect( box );
389+
390+
//scale bars have a minimum size, respect that regardless of data defined settings
391+
if ( newRect.width() < box.width() )
392+
{
393+
newRect.setWidth( box.width() );
394+
}
395+
if ( newRect.height() < box.height() )
396+
{
397+
newRect.setHeight( box.height() );
398+
}
399+
400+
setSceneRect( newRect );
389401
}
390402

391403
void QgsComposerScaleBar::update()

0 commit comments

Comments
 (0)
Please sign in to comment.