@@ -68,6 +68,8 @@ void QgsComposerPicture::init()
68
68
// connect to atlas feature changing
69
69
connect ( &mComposition ->atlasComposition (), SIGNAL ( featureChanged ( QgsFeature* ) ), this , SLOT ( refreshPicture () ) );
70
70
71
+ // connect to composer print resolution changing
72
+ connect ( mComposition , SIGNAL ( printResolutionChanged () ), this , SLOT ( recalculateSize () ) );
71
73
}
72
74
73
75
QgsComposerPicture::~QgsComposerPicture ()
@@ -275,7 +277,7 @@ void QgsComposerPicture::loadPicture( const QFile& file )
275
277
276
278
if ( mMode != Unknown ) // make sure we start with a new QImage
277
279
{
278
- setSceneRect ( QRectF ( pos (). x (), pos (). y (), rect (). width (), rect (). height () ) );
280
+ recalculateSize ( );
279
281
}
280
282
emit itemChanged ();
281
283
}
@@ -463,11 +465,18 @@ void QgsComposerPicture::setResizeMode( QgsComposerPicture::ResizeMode mode )
463
465
|| ( mode == QgsComposerPicture::Zoom && mPictureRotation != 0 ) )
464
466
{
465
467
// call set scene rect to force item to resize to fit picture
466
- setSceneRect ( QRectF ( pos (). x (), pos (). y (), rect (). width (), rect (). height () ) );
468
+ recalculateSize ( );
467
469
}
468
470
update ();
469
471
}
470
472
473
+ void QgsComposerPicture::recalculateSize ()
474
+ {
475
+ // call set scene rect with current position/size, as this will trigger the
476
+ // picture item to recalculate its frame and image size
477
+ setSceneRect ( QRectF ( pos ().x (), pos ().y (), rect ().width (), rect ().height () ) );
478
+ }
479
+
471
480
void QgsComposerPicture::setUsePictureExpression ( bool useExpression )
472
481
{
473
482
if ( useExpression == mUseSourceExpression )
0 commit comments