Skip to content

Commit 2e9bff0

Browse files
committed
iconloader: Consider scale in actualSize() & pixmap()
These APIs don't provide the scaling information, we will guess it by using the application's one (Qt does it similarly in such cases).
1 parent a16bb2d commit 2e9bff0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/xdgiconloader/xdgiconloader.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,8 @@ QSize XdgIconLoaderEngine::actualSize(const QSize &size, QIcon::Mode mode,
768768

769769
ensureLoaded();
770770

771-
QIconLoaderEngineEntry *entry = entryForSize(size);
771+
const qreal scale = qApp->devicePixelRatio();// Don't know which window to target
772+
QIconLoaderEngineEntry *entry = entryForSize(size, scale);
772773
if (entry) {
773774
const QIconDirInfo &dir = entry->dir;
774775
if (dir.type == QIconDirInfo::Scalable || dynamic_cast<ScalableEntry *>(entry))
@@ -973,7 +974,8 @@ QPixmap XdgIconLoaderEngine::pixmap(const QSize &size, QIcon::Mode mode,
973974
{
974975
ensureLoaded();
975976

976-
QIconLoaderEngineEntry *entry = entryForSize(size);
977+
const qreal scale = qApp->devicePixelRatio();// Don't know which window to target
978+
QIconLoaderEngineEntry *entry = entryForSize(size, scale);
977979
if (entry)
978980
return entry->pixmap(size, mode, state);
979981

0 commit comments

Comments
 (0)