Skip to content

Commit 5c8cd77

Browse files
committedApr 28, 2014
[composer] Don't resize picture frame to invalid sizes (sponsored by City of Uster, Switzerland)
1 parent 021da60 commit 5c8cd77

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed
 

‎src/core/composer/qgscomposerpicture.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ void QgsComposerPicture::setSceneRect( const QRectF& rectangle )
364364

365365
QRectF newRect = rectangle;
366366

367-
if ( mResizeMode == ZoomResizeFrame && !rect().isEmpty() )
367+
if ( mResizeMode == ZoomResizeFrame && !rect().isEmpty() && !( currentPictureSize.isEmpty() ) )
368368
{
369369
//if width has changed less than height, then fix width and set height correspondingly
370370
//else, do the opposite
@@ -380,8 +380,11 @@ void QgsComposerPicture::setSceneRect( const QRectF& rectangle )
380380
}
381381
else if ( mResizeMode == FrameToImageSize )
382382
{
383-
newRect.setWidth( currentPictureSize.width() * 25.4 / mComposition->printResolution() );
384-
newRect.setHeight( currentPictureSize.height() * 25.4 / mComposition->printResolution() );
383+
if ( !( currentPictureSize.isEmpty() ) )
384+
{
385+
newRect.setWidth( currentPictureSize.width() * 25.4 / mComposition->printResolution() );
386+
newRect.setHeight( currentPictureSize.height() * 25.4 / mComposition->printResolution() );
387+
}
385388
}
386389

387390
//find largest scaling of picture with this rotation which fits in item

0 commit comments

Comments
 (0)
Please sign in to comment.