aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickimagebase.cpp
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@digia.com>2014-05-19 14:42:14 +0200
committerMorten Johan Sørvig <morten.sorvig@digia.com>2014-07-03 09:18:23 +0200
commit2728460e62f8d4a5f7c3b884562aea9a526f9bb3 (patch)
tree2fba75e29881cd577d7957e3dd4defa61ef259b1 /src/quick/items/qquickimagebase.cpp
parent2dcad8f5c899ecec459d9e2a2c30211ee9e6c20c (diff)
Add opt-out environment variable for @2x images
There are cases where @2x images are in use but where you don't want the associated behavior: - You are implementing an image editor - You are inheriting a resource set which has @2x images, but don't want that behavior with Qt. Add support for disabling @2x behavior with QT_HIGHDPI_DISABLE_2X_IMAGE_LOADING. Change-Id: Ia570dfe556e0571a19e5ebdc626c4a7e626721b9 Task-id: QTBUG-38485 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Diffstat (limited to 'src/quick/items/qquickimagebase.cpp')
-rw-r--r--src/quick/items/qquickimagebase.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/quick/items/qquickimagebase.cpp b/src/quick/items/qquickimagebase.cpp
index 66a56cc8bf..bf67cbef26 100644
--- a/src/quick/items/qquickimagebase.cpp
+++ b/src/quick/items/qquickimagebase.cpp
@@ -332,6 +332,11 @@ void QQuickImageBase::resolve2xLocalFile(const QUrl &url, qreal targetDevicePixe
Q_ASSERT(sourceUrl);
Q_ASSERT(sourceDevicePixelRatio);
+ // Bail out if "@2x" image loading is disabled, don't change the source url or devicePixelRatio.
+ static bool disable2xImageLoading = !qgetenv("QT_HIGHDPI_DISABLE_2X_IMAGE_LOADING").isEmpty();
+ if (disable2xImageLoading)
+ return;
+
QString localFile = QQmlFile::urlToLocalFileOrQrc(url);
// Non-local file path: @2x loading is not supported.