Skip to content

Commit

Permalink
fix: the default icon is displayed incorrectly when zooming
Browse files Browse the repository at this point in the history
The default icon needs to be scaled when the system scales.

Log: the default icon is displayed incorrectly
Bug: https://pms.uniontech.com/bug-view-277471.html
  • Loading branch information
xionglinlin authored and deepin-bot[bot] committed Oct 14, 2024
1 parent 2328b7e commit b522efc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/private/dquickimageprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ static QImage requestImageFromQIcon(const QString &id, QSize *size, const QSize
} else {
icon = DIconTheme::findQIcon(name);
}
if (icon.isNull())
return invalidIcon(size, requestedSize);

QIcon::Mode qMode = QIcon::Normal;
QIcon::State qState = QIcon::Off;
Expand All @@ -66,6 +64,11 @@ static QImage requestImageFromQIcon(const QString &id, QSize *size, const QSize
devicePixelRatio = 1.0;
}

if (icon.isNull()) {
QSize icon_size = requestedSize;
return invalidIcon(size, icon_size /= devicePixelRatio);
}

QSize icon_size = requestedSize;
// 初始时可能没有为图标设置期望的大小
if (icon_size.isEmpty()) {
Expand Down

0 comments on commit b522efc

Please sign in to comment.