Respect image orientation and transforms in attachment widget

Fixes #16139
This commit is contained in:
Nyall Dawson 2018-02-26 07:46:39 +10:00
parent 8ef90807f2
commit 574a6549f8

View File

@ -22,6 +22,7 @@
#include <QGridLayout>
#include <QVariant>
#include <QSettings>
#include <QImageReader>
#ifdef WITH_QTWEBKIT
#include <QWebView>
#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();
}