Skip to content

chore: update DTK dependency and fix icon display#711

Merged
mhduiy merged 1 commit into
linuxdeepin:masterfrom
mhduiy:iconsize
Feb 27, 2026
Merged

chore: update DTK dependency and fix icon display#711
mhduiy merged 1 commit into
linuxdeepin:masterfrom
mhduiy:iconsize

Conversation

@mhduiy
Copy link
Copy Markdown
Contributor

@mhduiy mhduiy commented Feb 27, 2026

Updated libdtk6declarative-dev dependency version from >= 6.0.19 to >> 6.7.33 to ensure compatibility with newer DTK features and bug fixes. Added fillMode: Image.PreserveAspectFit to IconImage component in IconItemDelegate.qml to prevent icon distortion and ensure proper aspect ratio preservation when scaling icons.

chore: 更新 DTK 依赖并修复图标显示

将 libdtk6declarative-dev 依赖版本从 >= 6.0.19 更新为 >> 6.7.33,以确保 兼容新的 DTK 功能和错误修复。在 IconItemDelegate.qml 的 IconImage 组件中 添加 fillMode: Image.PreserveAspectFit,防止图标变形并确保缩放时保持正确 的宽高比。

PMS: BUG-301329

Summary by Sourcery

Update DTK dependency and adjust icon rendering to maintain correct display in the UI.

Bug Fixes:

  • Prevent icon distortion by preserving aspect ratio when scaling icons in the icon item delegate.

Build:

  • Raise libdtk6declarative-dev minimum version to 6.7.33 to align with newer DTK capabilities and fixes.

Chores:

  • Extend SPDX copyright year range for UnionTech Software Technology Co., Ltd. in the QML delegate file.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Feb 27, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates the DTK QML dependency to a newer libdtk6declarative-dev version and adjusts the icon delegate to preserve aspect ratio when rendering icons, plus refreshes the file copyright years.

Flow diagram for icon rendering with PreserveAspectFit

flowchart TD
  A[IconItemDelegate_loads] --> B[IconImage_component_created]
  B --> C[Set_scale_based_on_parent_and_iconScaleFactor]
  C --> D[Apply_DTK_icon_palette]
  D --> E[Apply_dark_theme_ApplicationHelper_DarkType]
  E --> F[Apply_fillMode_Image_PreserveAspectFit]
  F --> G[Render_icon_preserving_aspect_ratio]

  subgraph Dependency_update_effect
    H[debian_control_requires_newer_libdtk6declarative_dev]
    H --> I[Build_uses_updated_DTK_QML_features]
    I --> B
  end
Loading

File-Level Changes

Change Details Files
Ensure icons in the item delegate preserve their aspect ratio and are not distorted when scaled.
  • Set the IconImage fillMode property to Image.PreserveAspectFit so icon scaling keeps correct proportions.
  • Leave existing scaling logic (scale based on parent width and maxIconSize) intact while improving visual output.
  • Retain existing palette and theme usage for icon rendering.
qml/IconItemDelegate.qml
Align metadata with current project and dependency requirements.
  • Update the SPDX copyright line to include years 2023 - 2026 for UnionTech Software Technology Co., Ltd.
  • Increase the libdtk6declarative-dev dependency version in the Debian control file from >= 6.0.19 to >> 6.7.33 to require a newer DTK release with necessary features and fixes.
qml/IconItemDelegate.qml
debian/control

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
Copy Markdown

@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 left some high level feedback:

  • In debian/control, using >> 6.7.33 enforces a strict > constraint instead of >=, which may unnecessarily exclude exactly version 6.7.33; consider whether >= 6.7.33 better matches the intended minimum supported version.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In debian/control, using `>> 6.7.33` enforces a strict `>` constraint instead of `>=`, which may unnecessarily exclude exactly version 6.7.33; consider whether `>= 6.7.33` better matches the intended minimum supported version.

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.

@mhduiy mhduiy requested review from 18202781743 and BLumia February 27, 2026 05:33
@deepin-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: BLumia, 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

Updated libdtk6declarative-dev dependency version from >= 6.0.19 to >>
6.7.33 to ensure compatibility with newer DTK features and bug fixes.
Added fillMode: Image.PreserveAspectFit to IconImage component in
IconItemDelegate.qml to prevent icon distortion and ensure proper aspect
ratio preservation when scaling icons.

chore: 更新 DTK 依赖并修复图标显示

将 libdtk6declarative-dev 依赖版本从 >= 6.0.19 更新为 >> 6.7.33,以确保
兼容新的 DTK 功能和错误修复。在 IconItemDelegate.qml 的 IconImage 组件中
添加 fillMode: Image.PreserveAspectFit,防止图标变形并确保缩放时保持正确
的宽高比。

PMS: BUG-301329
@deepin-ci-robot
Copy link
Copy Markdown

deepin pr auto review

这份代码修改主要涉及两个文件:debian/control(包依赖配置)和 qml/IconItemDelegate.qml(UI界面代码)。以下是对这两处修改的详细审查意见:

1. 文件:debian/control

修改内容:
libdtk6declarative-dev 的依赖版本从 (>= 6.0.19) 修改为 (>> 6.7.33)

审查意见:

  • 逻辑与兼容性风险(高):
    • 版本号跨度巨大:6.0.19 直接跳到 >> 6.7.33(严格大于 6.7.33),这是一个非常大的版本跨度。通常情况下,如果代码只是使用了新特性,应该使用 >=(大于等于)以确保兼容性。使用 >> 意味着如果用户安装了 6.7.33 这个版本,构建将会失败。
    • 建议修改为 >= 除非 6.7.33 版本本身存在严重的已知 Bug 必须避开,否则建议将 >> 改回 >=,即 libdtk6declarative-dev (>= 6.7.33)。这样可以确保只要系统中的库版本不低于 6.7.33 即可满足构建条件,符合常规的依赖管理逻辑。
  • 依赖一致性(中):
    • 请检查 libdtk6gui-dev 和其他 DTK 相关库的版本要求。如果 libdtk6declarative-dev 需要 6.7.33,通常 GUI 核心库也需要相应的版本支持。目前的 diff 中 libdtk6gui-dev 仍停留在 (>= 6.0.19),这可能会导致运行时库版本不匹配的问题。请确认 DTK 各组件之间的版本兼容性矩阵。

2. 文件:qml/IconItemDelegate.qml

修改 1:版权年份更新

修改内容:
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. -> 2023 - 2026

审查意见:

  • 规范性: 更新版权年份是标准操作,符合开源规范。
  • 时间范围: 将年份更新为未来(2026)是合法的,表示版权预期持续到该年份。这没有问题。

修改 2:添加 fillMode 属性

修改内容:
D.DciIcon 组件中添加了 fillMode: Image.PreserveAspectFit

审查意见:

  • 代码逻辑与视觉效果(正面):
    • 保持比例: Image.PreserveAspectFit 确保图标在缩放时保持宽高比,不会变形。这对于图标显示是非常重要的,避免了图标被拉伸或压扁,提升了 UI 的视觉质量。
  • 代码性能(低影响):
    • PreserveAspectFit 是 Qt/QML 中非常基础的渲染模式,性能开销极小,对性能无负面影响。
  • 代码质量(建议):
    • 上下文检查: 代码中已经设置了 scale 属性来控制图标大小。结合 fillMode: PreserveAspectFit,这意味着图标会先按比例缩放以适应容器,同时保持比例。请确保这符合设计预期(即图标可能不会填满整个 parent.width,可能会留有空白)。如果设计要求图标必须填满区域(即使变形),则不应添加此属性;但通常对于图标来说,保持比例是正确的选择。
  • 语法: 语法正确,符合 QML 规范。

总结建议

  1. 关键修改: 请务必核实 debian/control 中的版本号运算符。强烈建议将 libdtk6declarative-dev (>> 6.7.33) 修改为 libdtk6declarative-dev (>= 6.7.33),除非有极强的特殊理由排除 6.7.33 这个确切版本。
  2. 依赖检查: 同步检查其他 libdtk6* 依赖包的版本要求,确保它们之间是兼容的。
  3. QML 修改: qml 文件的修改是合理的,有助于提升 UI 表现质量。

@mhduiy mhduiy merged commit 26180a0 into linuxdeepin:master Feb 27, 2026
9 of 10 checks passed
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