fix(tray-tooltip): apply DTK t8 font to tray tooltips - #499
deepin-bot[bot] merged 1 commit into
Conversation
|
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 Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions 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. |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideUpdates 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 refreshsequenceDiagram
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()
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
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>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
ca5e265 to
a7b8504
Compare
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: 工具提示字体随系统设置缩放,修复提示字体大小不一致问题
a7b8504 to
de917a5
Compare
|
[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. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/merge |
|
This pr cannot be merged! (status: blocked) |
|
/forcemerge |
|
This pr force merged! (status: blocked) |
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 字体
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:
Bug Fixes:
Enhancements: