Skip to content

fix(icons): restore smooth scaling to prevent jagged icon edges#583

Merged
deepin-bot[bot] merged 1 commit intolinuxdeepin:masterfrom
re2zero:bugfix
Mar 9, 2026
Merged

fix(icons): restore smooth scaling to prevent jagged icon edges#583
deepin-bot[bot] merged 1 commit intolinuxdeepin:masterfrom
re2zero:bugfix

Conversation

@re2zero
Copy link
Contributor

@re2zero re2zero commented Mar 8, 2026

Restore smooth=true behavior to avoid jagged edges when icons are scaled.

恢复平滑缩放以修复图标放大时圆角显示锯齿的问题。

Log: 恢复 DQuickDciIconImage 平滑缩放
PMS: BUG-308655
Influence: 修复 QML 中 DCI 图标放大时圆角显示锯齿的问题,图标边缘更平滑。

Summary by Sourcery

Bug Fixes:

  • Fix jagged, aliased edges on scaled DQuickDciIconImage icons by re-enabling smooth rendering.

@sourcery-ai
Copy link

sourcery-ai bot commented Mar 8, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Removes an explicit smooth=false setting from the DQuickDciIconImage constructor so that the underlying QQuickImage can use smooth scaling again, restoring anti-aliased icon edges when scaled.

Sequence diagram for smooth property propagation in DQuickDciIconImage

sequenceDiagram
participant Client
participant DQuickDciIconImage as DQuickDciIconImage
participant DQuickDciIconImagePrivate as Private
participant QQuickImage as ImageItem

Client->>DQuickDciIconImage: DQuickDciIconImage(parent)
activate DQuickDciIconImage
DQuickDciIconImage->>Private: create d
Private->>ImageItem: create imageItem
DQuickDciIconImage->>ImageItem: connect implicitWidthChanged
DQuickDciIconImage->>ImageItem: connect implicitHeightChanged
DQuickDciIconImage->>ImageItem: connect smoothChanged_to_setSmooth
deactivate DQuickDciIconImage

Client->>DQuickDciIconImage: setSmooth(true)
DQuickDciIconImage-->>Client: smoothChanged(true)
DQuickDciIconImage->>ImageItem: setSmooth(true)
Loading

Class diagram for DQuickDciIconImage smooth scaling behavior

classDiagram
class DQuickDciIconImage {
  +DQuickDciIconImage(parent: QQuickItem*)
  +bool smooth
  +smoothChanged(smooth: bool)
}

class DQuickDciIconImagePrivate {
  +QQuickImage* imageItem
}

class QQuickImage {
  +setSmooth(smooth: bool)
  +implicitWidthChanged()
  +implicitHeightChanged()
}

DQuickDciIconImage --> DQuickDciIconImagePrivate : has_d
DQuickDciIconImagePrivate --> QQuickImage : has_imageItem
DQuickDciIconImage ..> QQuickImage : smoothChanged_to_setSmooth
Loading

File-Level Changes

Change Details Files
Allow DQuickDciIconImage to use smooth image scaling again to avoid jagged edges on scaled icons.
  • Removed the explicit call that disabled smoothing in the DQuickDciIconImage constructor so the default smoothing behavior is restored.
  • Kept the existing connection that propagates the DQuickDciIconImage smoothChanged signal to the internal QQuickImage, ensuring smoothing can still be controlled via the smooth property.
src/private/dquickdciiconimage.cpp

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Restore smooth=true behavior to avoid jagged edges when icons are scaled.

恢复平滑缩放以修复图标放大时圆角显示锯齿的问题。

Log: 恢复 DQuickDciIconImage 平滑缩放
PMS: BUG-308655
Influence: 修复 QML 中 DCI 图标放大时圆角显示锯齿的问题,图标边缘更平滑。
@deepin-ci-robot
Copy link
Contributor

deepin pr auto review

这段代码是关于 DQuickDciIconImage 构造函数的修改,主要是删除了一行 setSmooth(false);。以下是对此修改的详细审查意见:

1. 语法逻辑

  • 审查结果通过
  • 分析:代码删除了 setSmooth(false); 的显式调用。语法上没有问题,C++ 允许删除构造函数中的初始化语句。逻辑上,这意味着 smooth 属性将不再被强制初始化为 false,而是取决于其默认值或后续的绑定/设置。

2. 代码质量

  • 审查结果需关注
  • 分析
    • 默认行为:删除该行后,DQuickDciIconImagesmooth 属性将遵循其声明时的默认值(通常为 true,除非在 Q_PROPERTY 中指定了默认为 false)。
    • 一致性:代码中有一行 connect(this, &DQuickDciIconImage::smoothChanged, d->imageItem, &QQuickImage::setSmooth);,这表明该组件的 smooth 状态会同步传递给内部的 d->imageItem
    • 潜在问题:如果删除这行代码是为了让图标默认开启平滑处理(看起来更柔和),那么修改是合理的。但如果之前的 false 是为了确保像素风格的图标保持锐利(不模糊),那么删除它可能会导致图标在高分辨率缩放时变模糊,影响视觉一致性。
    • 建议:请确认设计需求。如果 UI 规范要求图标默认是锐利的(非平滑),则不应删除此行,或者应显式保留默认设置。如果需求是默认平滑,则此修改是正确的。

3. 代码性能

  • 审查结果通过
  • 分析:删除一行构造函数中的函数调用对性能几乎没有影响,甚至微乎其微地减少了初始化时的开销。平滑处理 (smooth) 的性能开销主要发生在渲染阶段,而不是初始化阶段。

4. 代码安全

  • 审查结果通过
  • 分析:此修改不涉及内存管理、指针操作或敏感数据处理,因此不会引入安全漏洞或崩溃风险。

总结与改进建议

总结
这段代码删除了强制设置抗锯齿为 false 的操作。这通常意味着开发者希望图标在默认情况下使用平滑渲染(抗锯齿),或者希望让 QML 属性绑定系统完全控制该属性,而不是在 C++ 构造函数中硬编码。

改进建议

  1. 确认默认值:请检查 DQuickDciIconImage 类定义中 smooth 属性的 Q_PROPERTY 声明。确保其默认值符合预期。
    • 例如:Q_PROPERTY(bool smooth READ smooth WRITE setSmooth NOTIFY smoothChanged) 默认通常是 true
    • 如果之前显式设置为 false 是为了性能(低端设备)或特定视觉风格(像素风),删除它可能会导致回归。
  2. 文档注释:如果此修改改变了类的默认行为,建议更新类的头文件注释或文档,明确说明默认的 smooth 状态。
  3. QML 绑定检查:检查使用 DQuickDciIconImage 的 QML 代码。如果之前依赖 C++ 默认为 false,而现在变成了 true,某些 UI 可能会出现意外的模糊。如果 QML 中显式绑定了 smooth: false,则此修改无影响。

结论:如果产品需求是图标默认开启抗锯齿以获得更好的视觉效果,那么此修改是正确的。如果是为了保持像素图的锐利度或遵循旧有的设计规范,建议撤销此修改。

@deepin-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743, re2zero

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@re2zero
Copy link
Contributor Author

re2zero commented Mar 9, 2026

/forcemerge

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Mar 9, 2026

This pr force merged! (status: unstable)

@deepin-bot deepin-bot bot merged commit 26c3977 into linuxdeepin:master Mar 9, 2026
20 of 21 checks passed
@re2zero re2zero deleted the bugfix branch March 9, 2026 02:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants