Skip to content

Commit

Permalink
[composer] Don't resize picture frame to invalid sizes (sponsored by …
Browse files Browse the repository at this point in the history
…City of Uster, Switzerland)
  • Loading branch information
nyalldawson committed Apr 28, 2014
1 parent 021da60 commit 5c8cd77
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/core/composer/qgscomposerpicture.cpp
Expand Up @@ -364,7 +364,7 @@ void QgsComposerPicture::setSceneRect( const QRectF& rectangle )

QRectF newRect = rectangle;

if ( mResizeMode == ZoomResizeFrame && !rect().isEmpty() )
if ( mResizeMode == ZoomResizeFrame && !rect().isEmpty() && !( currentPictureSize.isEmpty() ) )
{
//if width has changed less than height, then fix width and set height correspondingly
//else, do the opposite
Expand All @@ -380,8 +380,11 @@ void QgsComposerPicture::setSceneRect( const QRectF& rectangle )
}
else if ( mResizeMode == FrameToImageSize )
{
newRect.setWidth( currentPictureSize.width() * 25.4 / mComposition->printResolution() );
newRect.setHeight( currentPictureSize.height() * 25.4 / mComposition->printResolution() );
if ( !( currentPictureSize.isEmpty() ) )
{
newRect.setWidth( currentPictureSize.width() * 25.4 / mComposition->printResolution() );
newRect.setHeight( currentPictureSize.height() * 25.4 / mComposition->printResolution() );
}
}

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

0 comments on commit 5c8cd77

Please sign in to comment.