Skip to content

Commit

Permalink
iconloader: Consider scale in actualSize() & pixmap()
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
palinek committed Mar 3, 2022
1 parent 99e3649 commit 5821616
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/xdgiconloader/xdgiconloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<ScalableEntry *>(entry))
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 5821616

Please sign in to comment.