Skip to content

fix: align non-DCI icon visual size with DCI icons in fullscreen launcher - #806

Closed
mhduiy wants to merge 1 commit into
linuxdeepin:masterfrom
mhduiy:agent/pms-bug-bot/cbbdbf682d9b
Closed

mhduiy wants to merge 1 commit into
linuxdeepin:masterfrom
mhduiy:agent/pms-bug-bot/cbbdbf682d9b

Conversation

@mhduiy

@mhduiy mhduiy commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Root Cause Analysis

In fullscreen launcher mode, the DciIcon QML element in IconItemDelegate.qml uses the same sourceSize (128) and scale for all icon sources. However, DCI icons (system apps) are rendered via DDciIcon::paint() with built-in DCI padding (RegardPaddingsAsSize flag), making their visible content smaller than sourceSize. Non-DCI icons (third-party apps with absolute icon paths converted to file:/// URLs in appsmodel.cpp:178) have no DCI padding and fill the entire sourceSize × scale area, causing them to appear visually larger than system app icons.

Key evidence:

  • qml/IconItemDelegate.qml — imageComponent uses identical sourceSize and scale for all icons, not distinguishing DCI vs non-DCI
  • src/models/appsmodel.cpp:178 — absolute path icons converted to file:/// URLs, becoming non-DCI icon sources
  • ddciicon.h — RegardPaddingsAsSize flag and actualSize() confirm DCI padding mechanism

Fix

Add a conservative scale factor (0.85) for non-DCI icons (detected via file:/// URL prefix) in the imageComponent of IconItemDelegate.qml. DCI icons are completely unaffected (factor = 1.0). The factor compensates for the missing DCI padding, aligning non-DCI icon visual size with DCI icons.

Change Safety Assessment

Risk level: Low

  • Code safety: The imageComponent is a local QML Component with no external callers (0 references found). The change only modifies the scale property — a multiplicative factor on the existing calculation. DCI icons are unaffected. No API changes, no new dependencies.
  • Business impact: Only affects fullscreen launcher icon rendering for third-party apps with absolute icon paths. Does not affect windowed mode (uses a different rendering path). No backend or DBus changes.
  • Verification suggestion: Verify that fullscreen mode system app icons (DCI) show no visual change, and that third-party app icons (absolute path) now match system app icon visual size. Confirm windowed mode icons are unaffected.

根因分析

全屏启动器模式下,IconItemDelegate.qml 中的 DciIcon QML 元素对所有图标源使用相同的 sourceSize(128)和 scale。但 DCI 图标(系统应用)通过 DDciIcon::paint() 渲染,DCI 格式内置 padding(RegardPaddingsAsSize 标志),可见内容区域小于 sourceSize。非 DCI 图标(第三方应用,.desktop 文件中绝对路径图标在 appsmodel.cpp:178 转为 file:/// URL)无 DCI padding,填满整个 sourceSize × scale 区域,导致视觉上明显大于系统应用图标。

修复方案

在 IconItemDelegate.qml 的 imageComponent 中,对非 DCI 图标(通过 file:/// URL 前缀检测)添加保守的缩减因子(0.85)。DCI 图标完全不受影响(因子 = 1.0)。该因子补偿缺失的 DCI padding,使非 DCI 图标视觉尺寸与 DCI 图标对齐。

改动安全评估

风险等级:低

  • 代码安全:imageComponent 是局部 QML Component,无外部调用者(0 引用)。改动仅修改 scale 属性——在现有计算上乘以一个因子。DCI 图标不受影响。无 API 变更,无新依赖。
  • 业务影响:仅影响全屏启动器中第三方应用(绝对路径图标)的图标渲染。不影响窗口模式(使用不同渲染路径)。无后端或 DBus 变更。
  • 验证建议:验证全屏模式下系统应用图标(DCI)无视觉变化,第三方应用图标(绝对路径)视觉尺寸与系统应用一致。确认窗口模式图标不受影响。

Summary by Sourcery

Bug Fixes:

  • Align the visual size of non-DCI fullscreen launcher icons with DCI system icons.

…cher

Non-DCI icons (file:/// URLs from absolute icon paths in .desktop files)
lack the built-in padding that the DCI format provides. When rendered at
the same sourceSize as DCI icons, they fill the entire area and appear
visually larger than system application icons.

Add a conservative scale factor (0.85) for non-DCI icons in the
imageComponent of IconItemDelegate.qml to compensate for the missing
DCI padding, aligning their visual size with DCI icons.

Log: fix fullscreen launcher icon size inconsistency between DCI and non-DCI icons
Bug: https://pms.uniontech.com/bug-view-361477.html

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sorry @mhduiy, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 5 hours and 41 minutes by commenting @sourcery-ai review. Upgrade to get a review now.

@sourcery-ai

sourcery-ai Bot commented Sep 14, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

The fullscreen launcher now renders non-DCI icons at 85% of their previous scale when their source is a file:/// URL, compensating for the padding inherent in DCI icons while preserving existing DCI behavior.

Flow diagram for fullscreen icon scale selection

flowchart TD
    A[Fullscreen launcher renders icon] --> B[DciIcon receives iconSource]
    B --> C{iconSource startsWith file:///}
    C -->|Yes| D[Apply nonDciScaleFactor 0.85]
    C -->|No| E[Use scale factor 1.0]
    D --> F[Render icon]
    E --> F[Render icon]
Loading

File-Level Changes

Change Details Files
Compensate for missing DCI icon padding by reducing non-DCI icon rendering scale in fullscreen mode.
  • Define a 0.85 scale factor for non-DCI icons.
  • Detect absolute-path icon URLs using the file:/// prefix and apply the factor only to those icons.
  • Leave DCI icon scaling unchanged.
qml/IconItemDelegate.qml

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

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mhduiy

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

@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

🤖 AI 代码审查报告

总体评分: 99 分 (通过阈值: 70分)

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 代码变更质量优秀。修改范围小且聚焦,仅在全屏启动器的imageComponent中对非DCI图标添加0.85缩放因子,使非DCI图标视觉尺寸与DCI图标对齐。变更添加了清晰的注释说明修改原因,使用命名属性替代魔法数字,DCI图标完全不受影响。语法正确,逻辑清晰,无安全漏洞,性能影响可忽略。唯一轻微改进建议是将较长的内联三元表达式提取为独立属性以提升可读性。

🔍 详细分析

1. 语法逻辑 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


2. 代码质量 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: ['scale属性绑定表达式较长,建议提取三元表达式为独立的只读属性以提升可读性']


3. 代码性能 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


4. 代码安全 🔒

评价: 优秀 ✅ 通过

🔐 发现 0 个安全漏洞

安全漏洞详情:
✅ 未发现安全漏洞

建议: []


💡 改进建议代码示例

// 暂无代码示例

本报告由 AI 代码审查工具自动生成

@mhduiy mhduiy closed this Sep 14, 2026
@mhduiy

mhduiy commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

我们正常的主题图标是有margin的,WPS和驱动的图标都是写死的指向自己安装的图标,且他的图标没有margin,直接铺满,所以看起来比其他的图标大,在逻辑上是没有办法解决的,应用也可以多给一点margin,让图标比其他图标小。该BUG建议不处理

修复方案不合理,关闭

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.

2 participants