Skip to content

Commit 4eef277

Browse files
committed
fix: prevent icon blurring during scaling
The changes modify how device pixel ratio updates are handled for icons to prevent blurring issues. Previously, the pixel ratio update was only applied to theme icons, but now it's applied universally to all icon types before checking the specific icon type. This ensures consistent scaling behavior across all icon types. The updateDevicePixelRatio call was moved outside the ThemeIconName condition check in both initialization and pixmapChange methods. This guarantees that all icons receive proper scaling treatment regardless of their type, fixing the blurring issue that occurred during scaling operations. Log: Fixed icon blurring issues during scaling operations Influence: 1. Test icon rendering at various zoom levels 2. Verify theme icons display clearly after scaling 3. Check non-theme icons for clarity after scaling 4. Test icon appearance across different DPI settings fix: 修复缩放导致的图标模糊问题 修改了图标设备像素比更新的处理方式以防止模糊问题。原先像素比更新仅应用于 主题图标,现在会在检查特定图标类型前统一应用于所有图标类型。这确保了所有 图标类型都能获得一致的缩放行为。 将updateDevicePixelRatio调用从ThemeIconName条件检查中移出,在初始化和 pixmapChange方法中都进行了此修改。这保证了所有图标都能获得适当的缩放处 理,修复了缩放操作导致的模糊问题。 Log: 修复了缩放操作导致的图标模糊问题 Influence: 1. 测试不同缩放级别下的图标渲染效果 2. 验证缩放后主题图标的清晰度 3. 检查非主题图标缩放后的清晰度 4. 测试不同DPI设置下的图标显示效果 PMS: BUG-321383
1 parent 1e26b98 commit 4eef277

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

src/private/dquickiconimage.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ void DQuickIconImagePrivate::init()
6666
{
6767
D_Q(DQuickIconImage);
6868

69-
if (iconType == ThemeIconName) {
70-
// 强制确保图标的缩放比例正确
71-
updateDevicePixelRatio(1.0);
69+
// 强制确保图标的缩放比例正确
70+
updateDevicePixelRatio(1.0);
7271

72+
if (iconType == ThemeIconName) {
7373
QObject::connect(DGuiApplicationHelper::instance()->applicationTheme(), SIGNAL(iconThemeNameChanged(QByteArray)),
7474
q, SLOT(maybeUpdateUrl()));
7575
// dtk build-in 类型的图标支持区分窗口主题色, 此处需在主题类型变化时更新图标
@@ -372,10 +372,8 @@ void DQuickIconImage::pixmapChange()
372372
// QQuickImage中只会在设置了souceSize的前提下才会计算图片自身的缩放比例
373373
// 此处强制确保图标的缩放比例正确
374374
D_D(DQuickIconImage);
375-
if (d->iconType == DQuickIconImagePrivate::ThemeIconName) {
376-
if (d->updateDevicePixelRatio(1.0)) {
377-
d->maybeUpdateUrl();
378-
}
375+
if (d->updateDevicePixelRatio(1.0)) {
376+
d->maybeUpdateUrl();
379377
}
380378

381379
QQuickImage::pixmapChange();

0 commit comments

Comments
 (0)