Skip to content

fix(attributes): use palette text color - #217

Open
Resurgamz wants to merge 1 commit into
linuxdeepin:release/eaglefrom
Resurgamz:feature/fix-BUG231619-clean
Open

fix(attributes): use palette text color#217
Resurgamz wants to merge 1 commit into
linuxdeepin:release/eaglefrom
Resurgamz:feature/fix-BUG231619-clean

Conversation

@Resurgamz

@Resurgamz Resurgamz commented Jul 23, 2026

Copy link
Copy Markdown

问题\n修复右侧工具属性栏中颜色属性标签与圆角控件文字颜色不一致的问题。\n\n## 修复方案\n颜色属性标签绘制时使用当前调色板的 QPalette::WindowText,替代硬编码的深浅主题色值,使其与 DTK 控件保持一致并随主题自动适配。\n\n## 验证\n- cmake --build obj-x86_64-linux-gnu -j2\n\n## PMS\n- BUG-231619\n- 根因分析:analysis-report.md

Summary by Sourcery

Bug Fixes:

  • Fix inconsistent text color for color attribute labels and rounded corner controls in the attributes sidebar by using the active palette window text color.

Use the current palette WindowText color for color property labels so they match adjacent DTK controls.

Log: 修复工具属性文字颜色与圆角控件不一致的问题

Bug: https://pms.uniontech.com/bug-view-231619.html
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Resurgamz

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 Jul 23, 2026

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

Reviewer's Guide

This PR updates the drawing logic for color attribute labels in the right-side attributes panel so that their text color is taken from the current palette’s WindowText instead of hard-coded theme colors, ensuring consistency with DTK controls and automatic theme adaptation.

File-Level Changes

Change Details Files
Use the widget’s QPalette WindowText color for the static "填充" and "描边" label text instead of hard-coded dark/light theme colors.
  • Replace conditional dark/light theme QColor selection with palette-based text color lookup.
  • Apply palette().color(QPalette::WindowText) in the fill area label painting routine.
  • Apply palette().color(QPalette::WindowText) in the border label painting routine.
src/frame/AttributesWidgets/private/cattributeitemwidget.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

@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

★ 总体评分:100分

■ 【总体评价】

代码优化了颜色获取方式,使用系统调色板替代硬编码颜色值
逻辑正确且无安全漏洞,提升了主题适配性和代码可维护性

■ 【详细分析】

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

paintFillAreapaintFillBorder 函数中,将三元运算符判断硬编码颜色的逻辑替换为调用 palette().color(QPalette::WindowText),语法正确且符合Qt框架的绘制规范。
潜在问题:无
建议:无需修改

  • 2.代码质量(优秀)✓

移除了硬编码的颜色字符串("#C0C6D4" 和 "#414D68")以及对 darkTheme 变量的依赖,直接使用系统主题提供的颜色,减少了魔法值,提高了代码的可读性和跨主题兼容性。
潜在问题:无
建议:无需修改

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

palette().color() 是一个非常轻量级的内联访问操作,不会对绘制性能产生负面影响。
建议:无需修改

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

漏洞对比统计:新增漏洞 0 个,减少漏洞 0 个,持平 0 个
本次修改仅涉及UI绘制颜色的获取方式变更,不涉及任何外部输入处理、文件操作或网络通信,不存在安全风险。

  • 建议:无需修改

■ 【改进建议代码示例】

// 当前代码已是最优实现,无需修改。
// 保持以下代码即可:
// painter->setPen(palette().color(QPalette::WindowText));

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

  • The darkTheme flag is no longer used in these paint methods; consider removing it (and any related unused paths) to keep the drawing logic lean and avoid confusion.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The `darkTheme` flag is no longer used in these paint methods; consider removing it (and any related unused paths) to keep the drawing logic lean and avoid confusion.

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.

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