mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-15 00:02:52 -04:00
Fix layout picture rotation
This commit is contained in:
parent
9251f486a0
commit
fc7afe83c1
@ -575,9 +575,11 @@ void QgsLayoutItemPicture::loadPicture( const QVariant &data )
|
||||
loadPictureUsingCache( mEvaluatedPath );
|
||||
}
|
||||
|
||||
mLoaded = false;
|
||||
if ( mMode != Qgis::PictureFormat::Unknown ) //make sure we start with a new QImage
|
||||
{
|
||||
recalculateSize();
|
||||
mLoaded = true;
|
||||
}
|
||||
else if ( mHasExpressionError || !mEvaluatedPath.isEmpty() )
|
||||
{
|
||||
@ -662,11 +664,15 @@ void QgsLayoutItemPicture::setPictureRotation( double rotation )
|
||||
{
|
||||
const double oldRotation = mPictureRotation;
|
||||
mPictureRotation = rotation;
|
||||
const QSizeF currentPictureSize = pictureSize();
|
||||
|
||||
// If the picture is not loaded yet, do not compute its rotated size
|
||||
if ( !mLoaded || currentPictureSize == QSizeF( 0, 0 ) )
|
||||
return;
|
||||
|
||||
if ( mResizeMode == Zoom )
|
||||
{
|
||||
//find largest scaling of picture with this rotation which fits in item
|
||||
const QSizeF currentPictureSize = pictureSize();
|
||||
const QRectF rotatedImageRect = QgsLayoutUtils::largestRotatedRectWithinBounds( QRectF( 0, 0, currentPictureSize.width(), currentPictureSize.height() ), rect(), mPictureRotation );
|
||||
mPictureWidth = rotatedImageRect.width();
|
||||
mPictureHeight = rotatedImageRect.height();
|
||||
@ -674,7 +680,6 @@ void QgsLayoutItemPicture::setPictureRotation( double rotation )
|
||||
}
|
||||
else if ( mResizeMode == ZoomResizeFrame )
|
||||
{
|
||||
const QSizeF currentPictureSize = pictureSize();
|
||||
const QRectF oldRect = QRectF( pos().x(), pos().y(), rect().width(), rect().height() );
|
||||
|
||||
//calculate actual size of image inside frame
|
||||
|
Loading…
x
Reference in New Issue
Block a user