diff options
Diffstat (limited to 'src/libs/installer/fileutils.cpp')
-rw-r--r-- | src/libs/installer/fileutils.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/libs/installer/fileutils.cpp b/src/libs/installer/fileutils.cpp index 76e5e3cd8..273901267 100644 --- a/src/libs/installer/fileutils.cpp +++ b/src/libs/installer/fileutils.cpp @@ -28,6 +28,7 @@ #include "fileutils.h" #include "globals.h" +#include "constants.h" #include <errors.h> #include <QtCore/QDateTime> @@ -40,6 +41,8 @@ #include <QtCore/QCoreApplication> #include <QImageReader> #include <QRandomGenerator> +#include <QGuiApplication> +#include <QScreen> #include <errno.h> @@ -707,3 +710,17 @@ QString QInstaller::replacePath(const QString &path, const QString &before, cons return QDir::cleanPath(after) + pathToPatch.mid(pathToReplace.size()); return path; } + +/*! + Replaces \a imagePath with high dpi image. If high dpi image is not provided or + high dpi screen is not in use, the original value is returned. +*/ +void QInstaller::replaceHighDpiImage(QString &imagePath) +{ + if (QGuiApplication::primaryScreen()->devicePixelRatio() >= 2 ) { + QFileInfo fi(imagePath); + QString highdpiPixmap = fi.absolutePath() + QLatin1Char('/') + fi.baseName() + scHighDpi + fi.suffix(); + if (QFileInfo::exists(highdpiPixmap)) + imagePath = highdpiPixmap; + } +} |