Skip to content

fix: bind fontManager to dialog labels/buttons for realtime font size update - #329

Open
robertkill wants to merge 2 commits into
masterfrom
fix/dialog-font-realtime-update
Open

fix: bind fontManager to dialog labels/buttons for realtime font size update#329
robertkill wants to merge 2 commits into
masterfrom
fix/dialog-font-realtime-update

Conversation

@robertkill

@robertkill robertkill commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Problem

更新方式选择弹窗(UpdateSelectDialog)和退出测试通道弹窗(QuitTestingChannelDialog)的字号不会跟随系统字号修改实时变更,需要重启控制中心才能生效。

根因:两个对话框都使用 D.DialogWindow(独立顶层窗口),其窗口字体在创建时确定,不会随系统字号变更自动更新。文件中的 D.Label / LabelD.Button / D.RecommandButton 均未绑定 D.DTK.fontManager,因此字号被冻结在创建时的状态。

Changes

  • src/dcc-update-plugin/qml/UpdateSelectDialog.qml
    • D.Label 添加 font: D.DTK.fontManager.t8
    • ButtonWithToolTip 内的 D.Button 添加 font: D.DTK.fontManager.t6
  • src/dcc-update-plugin/qml/QuitTestingChannelDialog.qml(同类问题)
    • Label 添加 font: D.DTK.fontManager.t8
    • D.Button / D.RecommandButton 添加 font: D.DTK.fontManager.t6

字号选择(t8 用于内容文字、t6 用于按钮)与同模块 UpdateControl.qmlUpdateHistoryDialog.qml 中已有的约定一致。

Testing

  • 修改系统字号后,弹窗字体实时跟随变化(无需重启控制中心)
  • 不同字号下弹窗布局正常、文字不截断
  • 弹窗按钮文字大小与其他对话框一致

Ref: DDE-70

Summary by Sourcery

Bind dialog labels and buttons in update-related QML dialogs to the global font manager so their font sizes update in real time with system font changes.

Bug Fixes:

  • Ensure UpdateSelectDialog text and action buttons follow system font size changes without requiring a control center restart.
  • Ensure QuitTestingChannelDialog text and action buttons follow system font size changes without requiring a control center restart.

…size update

UpdateSelectDialog.qml and QuitTestingChannelDialog.qml used D.DialogWindow
(a standalone top-level window) without binding components to D.DTK.fontManager,
so their font sizes did not follow system font size changes in real time and
required restarting dde-control-center to take effect.

- UpdateSelectDialog.qml: add font: D.DTK.fontManager.t8 to the D.Label,
  font: D.DTK.fontManager.t6 to the ButtonWithToolTip D.Button
- QuitTestingChannelDialog.qml: add font: D.DTK.fontManager.t8 to the Label,
  font: D.DTK.fontManager.t6 to D.Button and D.RecommandButton

Font sizes (t8 for content text, t6 for buttons) match the convention already
used in UpdateControl.qml and UpdateHistoryDialog.qml.

Issue: DDE-70
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: robertkill

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

@sourcery-ai

sourcery-ai Bot commented Aug 10, 2026

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

Reviewer's Guide

Binds dialog text labels and buttons in update-related QML dialogs to DTK's fontManager so their font sizes react to system font size changes in real time, aligning typography with existing module conventions.

File-Level Changes

Change Details Files
Bind dialog content labels to DTK fontManager body font so text size updates with system settings.
  • Set the main descriptive Label in QuitTestingChannelDialog to use fontManager.t8.
  • Set the main descriptive D.Label in UpdateSelectDialog to use fontManager.t8.
src/dcc-update-plugin/qml/QuitTestingChannelDialog.qml
src/dcc-update-plugin/qml/UpdateSelectDialog.qml
Bind dialog buttons to DTK fontManager button font so button text size updates with system settings and matches other dialogs.
  • Set Cancel D.Button and Exit D.RecommandButton in QuitTestingChannelDialog to use fontManager.t6.
  • Set the ButtonWithToolTip component’s D.Button in UpdateSelectDialog to use fontManager.t6.
src/dcc-update-plugin/qml/QuitTestingChannelDialog.qml
src/dcc-update-plugin/qml/UpdateSelectDialog.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

@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.

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.

…lDialog

Fix SPDX CI check failure: the copyright header only listed 2025, update to
'2025 - 2026' to match the convention used in other files in this module
(e.g. UpdateSelectDialog.qml).

Ref: DDE-70
@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

★ 总体评分:100分

■ 【总体评价】

代码实现了对话框UI字体的DTK规范化,整体质量优秀且无任何风险
逻辑正确、符合规范且无安全漏洞,无需扣分

■ 【详细分析】

  • 1.语法逻辑(完全正确)✓

代码在 QuitTestingChannelDialog.qmlUpdateSelectDialog.qml 中准确地为 D.LabelD.Button 等组件添加了 font: D.DTK.fontManager.t8t6 的属性赋值,QML语法完全正确,版权年份更新符合规范。
建议:无需修改

  • 2.代码质量(符合规范)✓

修改精准命中UI规范缺陷,统一了正文与按钮的字体标准,消除了不同环境下显示不一致的隐患。
潜在问题:在 UpdateSelectDialog.qmlButtonWithToolTip 组件中,由于自定义了 contentItem: Text,直接在外部设置 font 属性可能无法自动传递给内部的 Text 元素,取决于内部 Text 是否显式绑定了 customButton.font
建议:检查 ButtonWithToolTip 内部 contentItem: Text 的实现,确保其包含 font: customButton.font 绑定,以防止字体设置被内部覆盖失效。

  • 3.代码性能(无性能问题)✓

新增的字体属性均为静态常量引用,不涉及动态计算、频繁重绘或额外的系统开销。
建议:无需修改

  • 4.代码安全(存在0个安全漏洞)✓

漏洞对比统计:新增漏洞 0 个,减少漏洞 0 个,持平 0 个
本次修改仅涉及QML界面UI字体属性的静态赋值,不包含任何网络请求、文件操作、命令执行或用户输入处理逻辑,无任何攻击面和安全风险。
建议:无需修改

■ 【改进建议代码示例】

// UpdateSelectDialog.qml:确保自定义 contentItem 的字体属性正确传递
component ButtonWithToolTip: D.Button {
    id: customButton
    font: D.DTK.fontManager.t6

    contentItem: Text {
        id: buttonText
        text: customButton.text
        font: customButton.font // 建议显式绑定,确保外部 t6 字体设置生效
        horizontalAlignment: Text.AlignHCenter
        verticalAlignment: Text.AlignVCenter
        // ... 其他原有属性
    }
}

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