diff options
author | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-12-08 07:09:26 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-12-08 07:09:47 +0100 |
commit | 3ec31ef9c5acd57a4a59c0d5f5e20b8d9a19bfa1 (patch) | |
tree | 8b55dd13dbc2a33fe7c857f622e10b817386bdb3 /src/gui/image/qicon.cpp | |
parent | 6f87f2d23fb50d8183ea173fe423b7e1a24c0e2e (diff) | |
parent | 4ad8798de428b44fe4c56e1ca111940068056c57 (diff) |
Merge remote-tracking branch 'origin/5.6' into dev
Change-Id: I2532c7f7db5e6cc3ef09753d886279816dd662b2
Diffstat (limited to 'src/gui/image/qicon.cpp')
-rw-r--r-- | src/gui/image/qicon.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index 6090f42ba7..ca77b73033 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. +** Copyright (C) 2015 Olivier Goffart <ogoffart@woboq.com> ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. @@ -1420,15 +1421,15 @@ QString qt_findAtNxFile(const QString &baseFileName, qreal targetDevicePixelRati if (disableNxImageLoading) return baseFileName; - QString atNx = QLatin1String("@%1x"); int dotIndex = baseFileName.lastIndexOf(QLatin1Char('.')); if (dotIndex == -1) /* no dot */ dotIndex = baseFileName.size(); /* append */ + QString atNxfileName = baseFileName; + atNxfileName.insert(dotIndex, QLatin1String("@2x")); // Check for @Nx, ..., @3x, @2x file versions, - for (int n = qCeil(targetDevicePixelRatio); n > 1; --n) { - QString atNxfileName = baseFileName; - atNxfileName.insert(dotIndex, atNx.arg(n)); + for (int n = qMin(qCeil(targetDevicePixelRatio), 9); n > 1; --n) { + atNxfileName[dotIndex + 1] = QLatin1Char('0' + n); if (QFile::exists(atNxfileName)) { if (sourceDevicePixelRatio) *sourceDevicePixelRatio = n; |