Conversation
In light mode, icon and text colours are #000000 with 70% opacity; in dark mode, icon and text colours are #ffffff with 70% opacity; on hover, icon and text colours are 100% opacity. Changes: - QuickButton (bluetooth, eye-comfort-mode, wirelesscasting): add m_parentHover member and setParentHover() method; change textColor.setAlphaF(1) to setAlphaF(m_parentHover ? 1.0 : 0.7); add m_parentHover to hover background condition - CommonIconButton: default colors changed from Qt::black/Qt::white to QColor(0,0,0,178)/QColor(255,255,255,178) (178≈70%×255); add m_parentHover and setParentHover(); updatePalette sets alpha 255 on hover; event() calls updatePalette() instead of update() - QuickPanelWidget (bluetooth, eye-comfort-mode, media, wirelesscasting): add enterEvent/leaveEvent to propagate hover to child buttons; add updateTextColor() to set 70%/100% alpha on labels - SignalQuickPanel: add hover propagation and updateTextColor() - JumpSettingButton: use 70% alpha colors; propagate hover to icon; add textColor.setAlphaF(0.7) in non-hover paintEvent - PluginItemDelegate: add textColor.setAlphaF(0.7) for non-selected items pms: bug-314503 Log: 调整快捷面板图标和文字颜色透明度,正常态70%,hover态100%
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: mhduiy 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 |
Reviewer's GuideThe PR standardizes quick-panel icon and list-text rendering to 70% opacity in light/dark themes, restores full opacity during hover, and propagates parent-panel hover state to child controls without changing secondary-panel title text behavior. Sequence diagram for quick-panel hover opacity propagationsequenceDiagram
participant User
participant QuickPanelWidget
participant CommonIconButton
participant Labels
User->>QuickPanelWidget: enterEvent(event)
QuickPanelWidget->>CommonIconButton: setParentHover(true)
CommonIconButton->>CommonIconButton: updatePalette()
QuickPanelWidget->>Labels: updateTextColor(true)
Note over CommonIconButton,Labels: Icons and list text use 100% opacity
User->>QuickPanelWidget: leaveEvent(event)
QuickPanelWidget->>CommonIconButton: setParentHover(false)
CommonIconButton->>CommonIconButton: updatePalette()
QuickPanelWidget->>Labels: updateTextColor(false)
Note over CommonIconButton,Labels: Icons and list text use 70% opacity
Flow diagram for theme-aware quick-panel colorsflowchart LR
Theme[DGuiApplicationHelper themeType] --> Light[Light theme: black at 70% alpha]
Theme --> Dark[Dark theme: white at 70% alpha]
Light --> Normal[Normal state]
Dark --> Normal
Hover[Parent or control hover] --> Full[Set alpha to 100%]
Normal --> Full
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 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="plugins/dde-dock/common/commoniconbutton.cpp" line_range="20-22" />
<code_context>
, m_hover(false)
+ , m_parentHover(false)
, m_state(Default)
- , m_lightThemeColor(Qt::black)
- , m_darkThemeColor(Qt::white)
+ , m_lightThemeColor(QColor(0, 0, 0, 178))
+ , m_darkThemeColor(QColor(255, 255, 255, 178))
, m_activeState(false)
, m_hoverEnable(true)
</code_context>
<issue_to_address>
**issue (broader_impact):** Changing the default `m_lightThemeColor` and `m_darkThemeColor` to 70% alpha does not affect buttons initialized through the string overload of `setIcon`, because that overload ends with `update()` rather than `updatePalette()`. Those callers retain the inherited opaque `WindowText` palette and do not receive the new normal-state opacity.
**Triggers:** When a `CommonIconButton` is configured with `setIcon(const QString &, const QString &, const QString &)` and is not later updated through a path that calls `updatePalette()`.
**Suggested fix:** Call `updatePalette()` from the string overload after selecting the icon.
</issue_to_address>| , m_lightThemeColor(Qt::black) | ||
| , m_darkThemeColor(Qt::white) | ||
| , m_lightThemeColor(QColor(0, 0, 0, 178)) | ||
| , m_darkThemeColor(QColor(255, 255, 255, 178)) | ||
| , m_activeState(false) |
There was a problem hiding this comment.
issue (broader_impact): Changing the default m_lightThemeColor and m_darkThemeColor to 70% alpha does not affect buttons initialized through the string overload of setIcon, because that overload ends with update() rather than updatePalette(). Those callers retain the inherited opaque WindowText palette and do not receive the new normal-state opacity.
Triggers: When a CommonIconButton is configured with setIcon(const QString &, const QString &, const QString &) and is not later updated through a path that calls updatePalette().
Suggested fix: Call updatePalette() from the string overload after selecting the icon.
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 优秀 ✅ 通过 潜在问题:
建议: 确认media组件中m_artistLab是否需要同步调整透明度。如需调整,在updateTextColor()中添加对m_artistLab的palette设置;如不需调整,建议添加注释说明原因。 2. 代码质量 ✅评价: 良好 ✅ 通过 潜在问题:
建议: 1.考虑将enterEvent()/leaveEvent()/updateTextColor()提取到公共基类或工具类中,减少跨插件代码重复 3. 代码性能 ✅评价: 优秀 ✅ 通过 潜在问题:
建议: 当前性能表现可接受。如需进一步优化,可在updatePalette()中添加对m_hover和m_parentHover状态变化的判断,仅在颜色实际需要变化时才重新设置palette。 4. 代码安全 🔒评价: 优秀 ✅ 通过
安全漏洞详情: 建议: 无安全风险。本次变更为纯UI渲染代码,不涉及用户输入处理、网络操作、文件系统访问或命令执行,无安全风险。 💡 改进建议代码示例// 建议在updateTextColor()方法中添加设计规范注释
// bluetooth/eye-comfort-mode/wirelesscasting QuickPanelWidget
void QuickPanelWidget::updateTextColor(bool hover)
{
// 设计规范:正常态70%透明度(alpha=0.7),hover态100%透明度(alpha=1.0)
// 浅色模式文字颜色#000000,深色模式文字颜色#ffffff
bool isLight = DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::LightType;
QColor color = isLight ? QColor(0, 0, 0) : QColor(255, 255, 255);
color.setAlphaF(hover ? 1.0 : 0.7);
QPalette pa = m_nameLabel->palette();
pa.setColor(QPalette::BrightText, color);
pa.setColor(QPalette::WindowText, color);
m_nameLabel->setPalette(pa);
m_stateLabel->setPalette(pa);
}
// media QuickPanelWidget - 建议确认是否需要同步更新m_artistLab
void QuickPanelWidget::updateTextColor(bool hover)
{
// 设计规范:正常态70%透明度,hover态100%透明度
bool isLight = DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::LightType;
QColor color = isLight ? QColor(0, 0, 0) : QColor(255, 255, 255);
color.setAlphaF(hover ? 1.0 : 0.7);
QPalette pa = m_titleLab->palette();
pa.setColor(QPalette::BrightText, color);
m_titleLab->setPalette(pa);
// TODO: 确认是否需要同步更新艺术家标签透明度
// pa = m_artistLab->palette();
// pa.setColor(QPalette::BrightText, color);
// m_artistLab->setPalette(pa);
}本报告由 AI 代码审查工具自动生成 |
|
TAG Bot New tag: 2.0.41 |
log: In light mode, icon and text colours are #000000 with 70% opacity; in dark mode, icon and text colours are #ffffff with 70% opacity; on hover, icon and text colours are 100% opacity. Furthermore, the text colour of the titles in the secondary panel does not need to be adjusted; only the colours of the icons and text in the list need to be adjusted.
pms: bug-314503
修复内容
快捷面板中图标和文字颜色当前使用纯色全不透明度渲染,未遵循系统颜色规范。本次修改按设计规范调整:
改动详情(14 文件,+240/-13)
QuickButton(bluetooth、eye-comfort-mode、wirelesscasting)
m_parentHover成员和setParentHover()方法initStyleOption中textColor.setAlphaF(1)→setAlphaF(m_parentHover ? 1.0 : 0.7)|| m_parentHover条件CommonIconButton
Qt::black/Qt::white改为QColor(0,0,0,178)/QColor(255,255,255,178)m_parentHover成员和setParentHover()方法updatePalette()中当m_hover || m_parentHover时设置 alpha 为 255event()中 Enter/Leave 时调用updatePalette()而非仅update()QuickPanelWidget(bluetooth、eye-comfort-mode、media、wirelesscasting)
enterEvent()/leaveEvent()传播 hover 到子按钮updateTextColor()设置 70%/100% 透明度SignalQuickPanel
updateTextColor()setIcon中颜色改为带透明度JumpSettingButton
setIcon颜色改为带透明度event()中传播 hover 到图标paintEvent非 hover 态添加textColor.setAlphaF(0.7)PluginItemDelegate
textColor.setAlphaF(0.7)参考
Summary by Sourcery
Update quick-panel icon and list text rendering to use theme-aware transparency and consistent hover emphasis.
Bug Fixes:
Enhancements: