Skip to content

fix: use DTK standard TextTips color and T7 font for tip label#89

Merged
lzwind merged 1 commit into
linuxdeepin:masterfrom
F-windy:fix/tiplabel-dtk-standard-style
Jul 8, 2026
Merged

fix: use DTK standard TextTips color and T7 font for tip label#89
lzwind merged 1 commit into
linuxdeepin:masterfrom
F-windy:fix/tiplabel-dtk-standard-style

Conversation

@F-windy

@F-windy F-windy commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

fix(tiplabel): use DTK TextTips color and T7 font

  1. Replace hardcoded tip label colors (109,124,136 / 138,161,180) with DPalette::TextTips so the label follows the theme palette
  2. Bind the tip label font to DFontSizeManager::T7 for consistent auxiliary tip sizing
  3. Apply TextTips color in both light and dark setIcons branches to keep them in sync
  4. Add the DPalette include for the new palette usage

Log: Use DTK standard TextTips color and T7 font for the tip label so it tracks theme palette changes

fix(tiplabel): 使用 DTK 标准 TextTips 颜色与 T7 字号

  1. 将提示标签硬编码颜色(109,124,136 / 138,161,180)替换为 DPalette::TextTips,使其随主题调色板统一变化
  2. 将提示标签字体绑定到 DFontSizeManager::T7,保证辅助提示字号一致
  3. 在 setIcons 的亮色与暗色分支均使用 TextTips 颜色,保持两套主题一致
  4. 新增 DPalette 头文件以支持调色板取色

Log: 使用 DTK 标准 TextTips 颜色与 T7 字号,让提示文字随主题调色板统一刷新
PMS: BUG-368759

@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 @F-windy, your pull request is larger than the review limit of 150000 diff characters

@deepin-ci-robot

Copy link
Copy Markdown

Hi @F-windy. Thanks for your PR. 😃

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@deepin-ci-robot

Copy link
Copy Markdown

Hi @F-windy. Thanks for your PR.

I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@F-windy F-windy force-pushed the fix/tiplabel-dtk-standard-style branch 2 times, most recently from 9996c9d to eb42b09 Compare July 3, 2026 02:55
@F-windy

F-windy commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA.

@F-windy

F-windy commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

recheck

1 similar comment
@F-windy

F-windy commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

recheck

@F-windy F-windy force-pushed the fix/tiplabel-dtk-standard-style branch from eb42b09 to 3252495 Compare July 6, 2026 05:48
deepin-bot Bot added a commit to linuxdeepin/cla that referenced this pull request Jul 6, 2026
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: F-windy, lzwind

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

1. Replace hardcoded tip label colors (109,124,136 / 138,161,180) with DPalette::TextTips so the label follows the theme palette
2. Bind the tip label font to DFontSizeManager::T7 for consistent auxiliary tip sizing
3. Apply TextTips color in both light and dark setIcons branches to keep them in sync
4. Add the DPalette include for the new palette usage

Log: Use DTK standard TextTips color and T7 font for the tip label so it tracks theme palette changes

fix(tiplabel): 使用 DTK 标准 TextTips 颜色与 T7 字号

1. 将提示标签硬编码颜色(109,124,136 / 138,161,180)替换为 DPalette::TextTips,使其随主题调色板统一变化
2. 将提示标签字体绑定到 DFontSizeManager::T7,保证辅助提示字号一致
3. 在 setIcons 的亮色与暗色分支均使用 TextTips 颜色,保持两套主题一致
4. 新增 DPalette 头文件以支持调色板取色

Log: 使用 DTK 标准 TextTips 颜色与 T7 字号,让提示文字随主题调色板统一刷新
PMS: BUG-368759
@F-windy F-windy force-pushed the fix/tiplabel-dtk-standard-style branch from 3252495 to 15096d2 Compare July 8, 2026 06:29
@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

★ 总体评分:100分

■ 【总体评价】

代码完美修复了深色/浅色主题切换时提示文字颜色硬编码的问题,使其遵循DTK规范动态变化
逻辑正确、代码规范且无任何安全风险,属于高质量的UI适配修复

■ 【详细分析】

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

在MainWidget::setupUi中正确引入DPalette头文件,通过DGuiApplicationHelper获取应用调色板并提取TextTips颜色赋值给QPalette,在MainWidget::setIcons的浅色与深色分支中均准确替换了原有的QColor硬编码,逻辑严密无误

  • 2.代码质量良好✓

移除了QColor(109, 124, 136)等魔法数字,统一使用DPalette::TextTips枚举,符合DTK框架开发规范;新增了DFontSizeManager绑定标准字号并添加了清晰的中文注释说明修改意图,局部使用大括号限制临时变量作用域,代码整洁度高

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

新增的DGuiApplicationHelper::instance()->applicationPalette()调用仅在主题切换和初始化时触发,属于极低频操作,获取调色板及颜色值的开销可忽略不计,不会引入任何性能瓶颈

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

漏洞对比统计:新增漏洞 0 个,减少漏洞 0 个,持平 0 个
本次修改纯粹涉及前端UI颜色的读取与设置,不涉及任何用户输入处理、文件操作、网络请求或命令执行,无攻击面

  • 建议:保持当前安全的编码方式

■ 【改进建议代码示例】

// 当前代码已足够优秀,无需额外改进,以下为当前最佳实践展示
void MainWidget::setupUi(QWidget *Widget)
{
    // ... 其他初始化代码
    m_tiplabel = new DLabel(Widget);
    m_tiplabel->setObjectName(QStringLiteral("tiplabel"));
    // 提示文字使用 DTK 标准的辅助提示字号与颜色,随主题统一刷新
    DFontSizeManager::instance()->bind(m_tiplabel, DFontSizeManager::T7);
    {
        DPalette dp = DGuiApplicationHelper::instance()->applicationPalette();
        QPalette pe;
        pe.setColor(QPalette::WindowText, dp.color(DPalette::TextTips));
        m_tiplabel->setPalette(pe);
    }
    // ... 其他布局代码
}

void MainWidget::setIcons(DGuiApplicationHelper::ColorType themeType)
{
    // ... 其他逻辑
    if (m_tiplabel) {
        DPalette dp = DGuiApplicationHelper::instance()->applicationPalette();
        QPalette pe;
        pe.setColor(QPalette::WindowText, dp.color(DPalette::TextTips));
        m_tiplabel->setPalette(pe);
    }
    // ... 其他逻辑
}

@lzwind lzwind merged commit 2b82aff into linuxdeepin:master Jul 8, 2026
21 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants