aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickimagebase.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-05-18 10:13:48 +0200
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-05-19 11:29:15 +0000
commit07882f73e8028577d9223b65a5abd6ffed5d2b35 (patch)
treefa6a2bca351dca8f1ae0b087901f0d1dd3efd1b2 /src/quick/items/qquickimagebase.cpp
parent0ace63da65a222873ecf4e966afe88afb89a25f8 (diff)
Optionally apply orientation on images
Adds the option to follow EXIF orientation. This was previuosly automatically applied to TIFF images, but not JPEGs except in Qt 5.4.1. [ChangeLog][Image] An autoTransform property has been added to control whether metadata image transforms such as EXIF orientation are automatically applied. By default it enabled for TIFF images and disabled for JPEG. Change-Id: I8a4cf204985b2a7d158a0e046e52db7cda970d20 Task-number: QTBUG-37946 Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Diffstat (limited to 'src/quick/items/qquickimagebase.cpp')
-rw-r--r--src/quick/items/qquickimagebase.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/quick/items/qquickimagebase.cpp b/src/quick/items/qquickimagebase.cpp
index b54c34765f..8fba6e3d12 100644
--- a/src/quick/items/qquickimagebase.cpp
+++ b/src/quick/items/qquickimagebase.cpp
@@ -195,6 +195,10 @@ void QQuickImageBase::load()
d->oldSourceSize = sourceSize();
emit sourceSizeChanged();
}
+ if (autoTransform() != d->oldAutoTransform) {
+ d->oldAutoTransform = autoTransform();
+ emit autoTransformBaseChanged();
+ }
update();
} else {
@@ -223,7 +227,7 @@ void QQuickImageBase::load()
resolve2xLocalFile(d->url, targetDevicePixelRatio, &loadUrl, &d->devicePixelRatio);
}
- d->pix.load(qmlEngine(this), loadUrl, d->sourcesize * d->devicePixelRatio, options);
+ d->pix.load(qmlEngine(this), loadUrl, d->sourcesize * d->devicePixelRatio, options, d->autoTransform);
if (d->pix.isLoading()) {
if (d->progress != 0.0) {
@@ -278,6 +282,10 @@ void QQuickImageBase::requestFinished()
d->oldSourceSize = sourceSize();
emit sourceSizeChanged();
}
+ if (autoTransform() != d->oldAutoTransform) {
+ d->oldAutoTransform = autoTransform();
+ emit autoTransformBaseChanged();
+ }
update();
}
@@ -368,4 +376,21 @@ void QQuickImageBase::resolve2xLocalFile(const QUrl &url, qreal targetDevicePixe
*sourceDevicePixelRatio = qreal(2.0);
}
+bool QQuickImageBase::autoTransform() const
+{
+ Q_D(const QQuickImageBase);
+ if (d->autoTransform == UsePluginDefault)
+ return d->pix.autoTransform() == ApplyTransform;
+ return d->autoTransform == ApplyTransform;
+}
+
+void QQuickImageBase::setAutoTransform(bool transform)
+{
+ Q_D(QQuickImageBase);
+ if (d->autoTransform != UsePluginDefault && transform == (d->autoTransform == ApplyTransform))
+ return;
+ d->autoTransform = transform ? ApplyTransform : DoNotApplyTransform;
+ emit autoTransformBaseChanged();
+}
+
QT_END_NAMESPACE