diff options
author | Morten Johan Sørvig <morten.sorvig@digia.com> | 2014-05-19 22:56:13 +0200 |
---|---|---|
committer | Morten Johan Sørvig <morten.sorvig@digia.com> | 2014-07-03 09:15:42 +0200 |
commit | 5f3ec26d90c239420d7865cba91e625283f08ba1 (patch) | |
tree | 33899ce5dfa98114ace1dac16665063825cf94cd /src/gui/image/qimagereader.cpp | |
parent | 19d289ab1b5bde3e136765e5432b5c7d004df3a4 (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: I206e050b6241f8935b4404c7a28b024a9e00d46c
Task-id: QTBUG-38485
Reviewed-by: Jake Petroules <jake.petroules@petroules.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Diffstat (limited to 'src/gui/image/qimagereader.cpp')
-rw-r--r-- | src/gui/image/qimagereader.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp index 091837b8b4..a10198a006 100644 --- a/src/gui/image/qimagereader.cpp +++ b/src/gui/image/qimagereader.cpp @@ -1247,8 +1247,9 @@ bool QImageReader::read(QImage *image) } // successful read; check for "@2x" file name suffix and set device pixel ratio. - if (QFileInfo(fileName()).baseName().endsWith(QLatin1String("@2x"))) { - image->setDevicePixelRatio(2.0); + static bool disable2xImageLoading = !qgetenv("QT_HIGHDPI_DISABLE_2X_IMAGE_LOADING").isEmpty(); + if (!disable2xImageLoading && QFileInfo(fileName()).baseName().endsWith(QLatin1String("@2x"))) { + image->setDevicePixelRatio(2.0); } return true; |