Skip to content

Conversation

@electricface
Copy link
Member

@electricface electricface commented Feb 2, 2026

--
【设备】【键盘】键盘测试文字偏大

Influence:【设备】【键盘】键盘测试文字
Log: 修复【控制中心】【设备】【键盘】键盘测试文字偏大
PMS: BUG-310105

Summary by Sourcery

Bug Fixes:

  • Reduce the displayed size of the keyboard test text in the device control center by updating its font style.

--
【设备】【键盘】键盘测试文字偏大

Influence:【设备】【键盘】键盘测试文字
Log: 修复【控制中心】【设备】【键盘】键盘测试文字偏大
PMS: BUG-310105
@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: electricface

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

sourcery-ai bot commented Feb 2, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adjusts the keyboard test text styling by switching the font preset used in the common keyboard QML component to reduce the displayed text size.

File-Level Changes

Change Details Files
Adjusted the keyboard test text font preset to change its rendered size in the keyboard plugin UI.
  • Updated the TextInput font binding from the t5 preset to the t8 preset in the shared keyboard QML component
  • Kept all layout, alignment, and behavior logic for the test text unchanged
src/plugin-keyboard/qml/Common.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

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

  • If t8 is now the preferred design token for this context, consider adding a short comment or using a more semantically named font style (e.g., a keyboardTestTextFont alias) so the intent is clearer and future design changes are easier to propagate.
  • Given the horizontal alignment depends on textMetrics.boundingRect.width > width, it may be worth manually checking that the new smaller font size still produces the desired centering/right-alignment behavior and does not result in awkward spacing or truncation in typical layouts.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- If `t8` is now the preferred design token for this context, consider adding a short comment or using a more semantically named font style (e.g., a `keyboardTestTextFont` alias) so the intent is clearer and future design changes are easier to propagate.
- Given the horizontal alignment depends on `textMetrics.boundingRect.width > width`, it may be worth manually checking that the new smaller font size still produces the desired centering/right-alignment behavior and does not result in awkward spacing or truncation in typical layouts.

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.

@deepin-ci-robot
Copy link

deepin pr auto review

这段代码修改将字体大小从 t5 调整为 t8,通常意味着缩小了字体尺寸。以下是对此修改的审查意见,涵盖语法逻辑、代码质量、代码性能和代码安全四个方面:

1. 语法逻辑

  • 审查结果通过
  • 分析:代码语法符合 QML 规范。font: D.DTK.fontManager.t8 是正确的属性绑定写法,只要 D.DTK.fontManager 对象中确实存在 t8 属性,逻辑上就没有问题。

2. 代码质量

  • 审查结果建议改进
  • 分析
    • 硬编码问题font: D.DTK.fontManager.t8 是一种硬编码的写法。虽然 DTK(Deepin Tool Kit)通常提供标准的字体样式(如 t5, t8),但在 UI 开发中,直接使用具体的字体等级(如 t8)可能会降低代码的可维护性。如果未来设计规范变更,需要全局调整此处的字体大小,可能需要搜索代码并逐个修改。
    • 建议:检查项目中是否有针对此类输入框定义的通用样式类型(例如 DTK.SmallFont 或自定义的样式对象)。如果有,建议使用更具语义化的样式属性,而不是直接调用具体的字体等级。

3. 代码性能

  • 审查结果通过
  • 分析
    • 此修改仅涉及属性的静态绑定,不涉及复杂的计算或循环。
    • D.DTK.fontManager 通常返回的是预定义的字体对象,引用开销极小,对性能无负面影响。

4. 代码安全

  • 审查结果通过
  • 分析
    • 此修改仅涉及 UI 渲染属性,不涉及数据处理、网络请求或权限操作,因此不存在常规的安全漏洞(如注入攻击、数据泄露等)。
    • 唯一的风险点是运行时如果 D.DTK.fontManager 未初始化或 t8 属性不存在,会导致组件加载失败。但考虑到这是基于 DTK 框架的修改,通常框架会保证这些 API 的稳定性。

总结与改进建议

该修改在语法和性能上没有问题,主要是为了适配 UI 设计调整字体大小。为了提高代码的健壮性和可维护性,建议进行以下改进:

  1. 确认设计规范:确认 t8 是否符合当前 UI 设计规范对于此类输入框(带 placeholderText: qsTr("test here"))的要求,确保字体大小不会过小导致用户难以看清。
  2. 可维护性优化
    • 如果项目中多处使用 t8 字体,建议在公共样式文件(如 CommonStyle.qmlTheme.qml)中定义一个语义化的属性,例如 property font inputPlaceholderFont: D.DTK.fontManager.t8
    • 在此处引用该属性:font: CommonStyle.inputPlaceholderFont。这样当设计变更时,只需修改一处即可全局生效。

修改后的建议代码示例(假设存在 CommonStyle):

// 假设在 Common.qml 或其他公共文件中定义了样式
// property font inputPlaceholderFont: D.DTK.fontManager.t8

// 在当前组件中使用
font: CommonStyle.inputPlaceholderFont 

如果只是临时调整或该处样式非常特殊,目前的写法也是可以接受的。

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