Fix adaptive icon painting (backport)

Fixes resolution problems on HighDPI.
Backport of c7323accf2
This commit is contained in:
Janek Bevendorff 2021-01-31 12:52:45 +01:00
parent f7d387d233
commit 48f2efbc92

View file

@ -179,15 +179,8 @@ AdaptiveIconEngine::AdaptiveIconEngine(QIcon baseIcon)
void AdaptiveIconEngine::paint(QPainter* painter, const QRect& rect, QIcon::Mode mode, QIcon::State state)
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
double dpr = !kpxcApp->testAttribute(Qt::AA_UseHighDpiPixmaps) ? 1.0 : painter->device()->devicePixelRatioF();
#else
double dpr = !kpxcApp->testAttribute(Qt::AA_UseHighDpiPixmaps) ? 1.0 : painter->device()->devicePixelRatio();
#endif
QSize pixmapSize = rect.size() * dpr;
painter->save();
painter->drawPixmap(rect, m_baseIcon.pixmap(pixmapSize, mode, state));
m_baseIcon.paint(painter, rect, Qt::AlignCenter, mode, state);
if (getMainWindow()) {
QPalette palette = getMainWindow()->palette();