From 58216164cdd57cfe0a019efb69e6219cf6091c3a Mon Sep 17 00:00:00 2001 From: Palo Kisa Date: Thu, 3 Mar 2022 10:56:34 +0100 Subject: [PATCH] iconloader: Consider scale in actualSize() & pixmap() These APIs don't provide the scaling information, we will guess it by using the application's one (QIcon does it similarly in such cases). --- src/xdgiconloader/xdgiconloader.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/xdgiconloader/xdgiconloader.cpp b/src/xdgiconloader/xdgiconloader.cpp index eb9e44a..2701b4e 100644 --- a/src/xdgiconloader/xdgiconloader.cpp +++ b/src/xdgiconloader/xdgiconloader.cpp @@ -768,7 +768,8 @@ QSize XdgIconLoaderEngine::actualSize(const QSize &size, QIcon::Mode mode, ensureLoaded(); - QIconLoaderEngineEntry *entry = entryForSize(size); + const int scale = qCeil(qApp->devicePixelRatio());// Don't know which window to target + QIconLoaderEngineEntry *entry = entryForSize(size, scale); if (entry) { const QIconDirInfo &dir = entry->dir; if (dir.type == QIconDirInfo::Scalable || dynamic_cast(entry)) @@ -973,7 +974,8 @@ QPixmap XdgIconLoaderEngine::pixmap(const QSize &size, QIcon::Mode mode, { ensureLoaded(); - QIconLoaderEngineEntry *entry = entryForSize(size); + const int scale = qCeil(qApp->devicePixelRatio());// Don't know which window to target + QIconLoaderEngineEntry *entry = entryForSize(size, scale); if (entry) return entry->pixmap(size, mode, state);