Skip to content

Commit

Permalink
fix: icon size changed on paletteChanged
Browse files Browse the repository at this point in the history
只在初始化和 sourceSizeChanged 时更新图标大小
防止出现 dpr > 1.0 时未设置 sourceSize 的 item 在 updatePlayer 时图标一直放大
没有设置 sourceSize 会根据图片大小去 match dci 中的图标大小
  • Loading branch information
kegechen committed Aug 19, 2024
1 parent 3318a32 commit b59d372
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/private/dquickdciiconimage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ void DQuickDciIconImageItemPrivate::updatePlayer()
QObject::connect(parentPriv->imageItem, &DQuickIconImage::sourceSizeChanged, player, [this](){
updatePlayerIconSize();
});

// 只在初始化和 sourceSizeChanged 时更新图标大小
// 防止出现 dpr > 1.0 时未设置 sourceSize 的 item 在 updatePlayer 时图标一直放大
updatePlayerIconSize();
}

QString iconPath = findDciIconPath(parentPriv->imageItem->name(), appIconThemeName());
Expand All @@ -155,8 +159,6 @@ void DQuickDciIconImageItemPrivate::updatePlayer()

player->setPalette(palette);

updatePlayerIconSize();

player->setDevicePixelRatio(devicePixelRatio);
}

Expand Down

0 comments on commit b59d372

Please sign in to comment.