From 574a6549f8d929c885b531fce827993c26fb034d Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Mon, 26 Feb 2018 07:46:39 +1000 Subject: [PATCH] Respect image orientation and transforms in attachment widget Fixes #16139 --- src/gui/qgsexternalresourcewidget.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gui/qgsexternalresourcewidget.cpp b/src/gui/qgsexternalresourcewidget.cpp index 5dcec13c2a9..7e1ae03f538 100644 --- a/src/gui/qgsexternalresourcewidget.cpp +++ b/src/gui/qgsexternalresourcewidget.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #ifdef WITH_QTWEBKIT #include #endif @@ -235,7 +236,10 @@ void QgsExternalResourceWidget::loadDocument( const QString &path ) if ( mDocumentViewerContent == Image ) { - QPixmap pm( resolvedPath ); + // use an image reader to ensure image orientation and transforms are correctly handled + QImageReader ir( resolvedPath ); + ir.setAutoTransform( true ); + QPixmap pm = QPixmap::fromImage( ir.read() ); mPixmapLabel->setPixmap( pm ); updateDocumentViewer(); }