Utils: Replace imageFileWithResolution with qt_findAtNxFile

qt_findAtNxFile does a better job at returing a suited @Nx-image for
"exotic" device pixel ratios. This change fixes for example the active
mode icon when running Qt Creator at 250% ui scaling.

Task-number: QTCREATORBUG-30464
Change-Id: Ia90ba3573fcd4af7941322d7dbc8905fe140192b
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
Alessandro Portale
2024-03-12 22:50:03 +01:00
parent c6ed1d42c3
commit 0817f7ae5e

View File

@@ -11,6 +11,7 @@
#include <QCommonStyle>
#include <QFileInfo>
#include <QFontDatabase>
#include <QIcon>
#include <QPainter>
#include <QPainterPath>
#include <QPixmapCache>
@@ -856,11 +857,7 @@ QString StyleHelper::dpiSpecificImageFile(const QString &fileName)
QString StyleHelper::imageFileWithResolution(const QString &fileName, int dpr)
{
const QFileInfo fi(fileName);
return dpr == 1 ? fileName :
fi.path() + QLatin1Char('/') + fi.completeBaseName()
+ QLatin1Char('@') + QString::number(dpr)
+ QLatin1String("x.") + fi.suffix();
return qt_findAtNxFile(fileName, dpr);
}
QList<int> StyleHelper::availableImageResolutions(const QString &fileName)