Skip to content

fix(tray-tooltip): apply DTK t8 font to tray tooltips - #499

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
MyLeeJiEun:fork-from-master-0828/bug-375465
Sep 1, 2026
Merged

deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
MyLeeJiEun:fork-from-master-0828/bug-375465

Conversation

@MyLeeJiEun

@MyLeeJiEun MyLeeJiEun commented Aug 28, 2026

Copy link
Copy Markdown
Contributor
  1. Set SNI tray tooltip font to DFontManager t8 style
  2. Re-apply the font on system font change via fontChanged signal
  3. Use t8 font in TipsWidget paintEvent for dock tips

Log: Tray and dock tooltips now follow the DTK t8 font and update on font change
Influence: Tooltip text follows system font style and refreshes when fonts change

fix(tray-tooltip): 托盘提示使用 DTK t8 字体

  1. SNI 托盘提示使用 DFontManager 的 t8 字体样式
  2. 系统字体变化时通过 fontChanged 信号重新应用字体
  3. TipsWidget 绘制时使用 t8 字体

Log: 托盘及 Dock 提示应用 DTK t8 字体,并随系统字体变化同步更新
PMS: BUG-375465
Influence: 提示文字跟随系统字体样式并随字体变化更新

Summary by Sourcery

Apply DTK T8 font styling to tray and dock tooltips and keep it synchronized with system font changes.

New Features:

  • Apply the DTK T8 font style to SNI tray and dock tooltip text.

Bug Fixes:

  • Ensure tray and dock tooltip fonts follow the system font style consistently.

Enhancements:

  • Bind tooltip widgets to DTK font management so their typography updates automatically when system fonts change.

@deepin-ci-robot

Copy link
Copy Markdown

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

@sourcery-ai

sourcery-ai Bot commented Aug 28, 2026

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

Reviewer's Guide

Updates tray and dock tooltip rendering to use the DTK DFontManager t8 style, with SNI tray tooltips reapplying the font when system font settings change.

Sequence diagram for DTK tooltip font application and refresh

sequenceDiagram
    participant Tooltip as SNITrayTooltip
    participant FM as DFontManager
    participant System as SystemFontSettings

    Tooltip->>FM: t8()
    FM-->>Tooltip: Return DTK t8 font
    Tooltip->>Tooltip: setFont()
    FM-->>Tooltip: fontChanged()
    Tooltip->>FM: t8()
    FM-->>Tooltip: Return updated t8 font
    Tooltip->>Tooltip: setFont()
Loading

File-Level Changes

Change Details Files
Apply the DTK t8 font consistently to SNI tray tooltips and refresh it when the system font changes.
  • Obtain the t8 font from DFontManager when creating/accessing the tooltip.
  • Subscribe to DFontManager::fontChanged and reapply the updated t8 font.
plugins/application-tray/sniprotocolhandler.cpp
Render dock tooltip text using the DTK t8 font.
  • Set the QPainter font from the application font manager before painting tooltip content.
  • Add the required DTK GUI and font manager includes.
plugins/dde-dock/widgets/tipswidget.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

@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 found 2 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="plugins/application-tray/sniprotocolhandler.cpp" line_range="252-260" />
<code_context>
+
+    const DFontManager *fm = DGuiApplicationHelper::instance()->fontManager();
+    m_tooltip->setFont(fm->t8());
+    connect(fm, &DFontManager::fontChanged, this, [this, fm] {
+        m_tooltip->setFont(fm->t8());
+    });

     if (!m_sniInter->toolTip().title.isEmpty()) {
</code_context>
<issue_to_address>
**nitpick (bug_risk):** `tooltip()` connects the same `fontChanged` signal every time it is called, even after `m_tooltip` already exists. `TrayPlugin::getToolTip()` calls `handler->tooltip()` twice and calls it again for every `NewToolTip`, so each font change invokes an ever-growing number of duplicate lambdas.

**Triggers:** When a tray item tooltip is refreshed or retrieved more than once before a system font change.

**Suggested fix:** Only establish the connection when creating `m_tooltip`, or use `Qt::UniqueConnection` with a persistent slot.

```suggestion
    const DFontManager *fm = DGuiApplicationHelper::instance()->fontManager();
    if (!m_tooltip) {
        const_cast<SniTrayProtocolHandler*>(this)->m_tooltip = new QLabel();
        m_tooltip->setForegroundRole(QPalette::BrightText);
        connect(fm, &DFontManager::fontChanged, this, [this, fm] {
            m_tooltip->setFont(fm->t8());
        });
    }

    m_tooltip->setFont(fm->t8());
```
</issue_to_address>

### Comment 2
<location path="plugins/dde-dock/widgets/tipswidget.cpp" line_range="85" />
<code_context>

     QPainter painter(this);
     painter.setPen(QPen(palette().brightText(), 1));
+    painter.setFont(Dtk::Gui::DGuiApplicationHelper::instance()->fontManager()->t8());

     QTextOption option;
</code_context>
<issue_to_address>
**issue (broader_impact):** `paintEvent()` draws with the DTK `t8` font, but `sizeHint()` and the multiline `lineHeight` calculation continue using the widget's inherited `fontMetrics()`. When those fonts have different metrics, the tooltip geometry is calculated for one font and painted with another, causing clipped text, incorrect spacing, or stale tooltip sizing.

**Triggers:** When the inherited widget font and `fontManager()->t8()` have different size or ascent/descent metrics.

**Suggested fix:** Store or apply the `t8` font to the widget before geometry calculations, and use metrics constructed from the same `t8` font in both `sizeHint()` and `paintEvent()`.
</issue_to_address>

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.

Comment thread plugins/application-tray/sniprotocolhandler.cpp Outdated
Comment thread plugins/dde-dock/widgets/tipswidget.cpp Outdated
@MyLeeJiEun
MyLeeJiEun force-pushed the fork-from-master-0828/bug-375465 branch 2 times, most recently from ca5e265 to a7b8504 Compare August 28, 2026 10:14
1. Bind SNI tray tooltip label to DFontSizeManager T8
2. Bind plugin item tooltip widget to DFontSizeManager T8
3. Remove hardcoded T5 binding from brightness tooltip to unify font size

Log: Dock tooltips now follow the system font size setting
Influence: Tooltip font scales with system setting; fixes inconsistent tooltip fonts

fix(dock): 工具提示字体跟随系统字体设置

1. 为 SNI 托盘工具提示绑定 DFontSizeManager T8
2. 为插件项工具提示绑定 DFontSizeManager T8
3. 移除亮度工具提示中硬编码的 T5 绑定,统一字体大小

Log: 任务栏工具提示字体跟随系统字体大小设置
PMS: BUG-375465
Influence: 工具提示字体随系统设置缩放,修复提示字体大小不一致问题
@MyLeeJiEun
MyLeeJiEun force-pushed the fork-from-master-0828/bug-375465 branch from a7b8504 to de917a5 Compare September 1, 2026 08:54
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mhduiy, MyLeeJiEun

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

@MyLeeJiEun

Copy link
Copy Markdown
Contributor Author

/merge

@deepin-bot

deepin-bot Bot commented Sep 1, 2026

Copy link
Copy Markdown

This pr cannot be merged! (status: blocked)

@MyLeeJiEun

Copy link
Copy Markdown
Contributor Author

/forcemerge

@deepin-bot

deepin-bot Bot commented Sep 1, 2026

Copy link
Copy Markdown

This pr force merged! (status: blocked)

@deepin-bot
deepin-bot Bot merged commit 644a0e3 into linuxdeepin:master Sep 1, 2026
5 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