diff options
-rw-r--r-- | src/quick/util/qquickpixmapcache.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/quick/util/qquickpixmapcache.cpp b/src/quick/util/qquickpixmapcache.cpp index 0033be82be..d5ef4b767f 100644 --- a/src/quick/util/qquickpixmapcache.cpp +++ b/src/quick/util/qquickpixmapcache.cpp @@ -1020,6 +1020,17 @@ static QQuickPixmapData* createPixmapDataSync(QQuickPixmap *declarativePixmap, Q if (localFile.isEmpty()) return 0; + // check for "retina" high-dpi and use @2x file if it exixts + if (qApp->devicePixelRatio() > 1) { + int dotIndex = localFile.lastIndexOf(QStringLiteral(".")); + if (dotIndex != -1) { + QString retinaFile = localFile; + retinaFile.insert(dotIndex, "@2x"); + if (QFile(retinaFile).exists()) + localFile = retinaFile; + } + } + QFile f(localFile); QSize readSize; QString errorString; |