Conversation
The OK button in the license disclaimer dialog uses a custom LicenseDialogButton with a custom initStyleOption. Two issues made disabled and enabled-normal states visually identical: 1. backgroundOpacity defaulted to 0.15 for both disabled and enabled-normal (only sunken/hover were overridden), so users could not tell whether the button was clickable from the background. 2. The highlighted text color was applied unconditionally when m_highlighted was true, ignoring State_Enabled, so the disabled OK button still showed the highlight text color. Fix: set backgroundOpacity to 0.05 for disabled state, and only apply the highlight text color when State_Enabled is set; use the disabledButtonText color otherwise. Log: yes Bug: https://pms.uniontech.com/bug-view-360973.html
|
[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 guide (collapsed on small PRs)Reviewer's GuideUpdates LicenseDialogButton styling so disabled and enabled-normal states are visually distinguishable, and prevents disabled highlighted buttons from using the active highlight text color. The change is isolated to initStyleOption in dde-license-dialog/src/content.cpp. Flow diagram for LicenseDialogButton state stylingflowchart TD
A["initStyleOption"] --> B{"State_Enabled?"}
B -->|Yes| C{"MouseOver or Sunken?"}
C -->|Sunken| D["backgroundOpacity = 0.25"]
C -->|MouseOver| E["backgroundOpacity = 0.2"]
C -->|Normal| F["backgroundOpacity = 0.15"]
B -->|No| G["backgroundOpacity = 0.05"]
D --> H{"m_highlighted?"}
E --> H
F --> H
G --> H
H -->|Yes and enabled| I["ButtonText = highlight color"]
H -->|Yes and disabled| J["ButtonText = Disabled ButtonText color"]
H -->|No| K["Keep ButtonText color"]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: 代码语法正确,逻辑清晰,无语法错误或逻辑缺陷。initStyleOption 方法中新增的 else 分支和嵌套 if-else 结构正确处理了所有状态分支。 2. 代码质量 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: 代码结构清晰,变更最小化,无重复代码。修改精准聚焦于问题根因,符合最小改动原则。 3. 代码性能 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: 性能良好,资源使用合理,无性能瓶颈。新增的条件分支仅涉及简单的浮点数赋值和 QPalette 颜色读取,对 UI 渲染性能无可感知影响。 4. 代码安全 🔒评价: 优秀 ✅ 通过
安全漏洞详情: 建议: 存在0个安全漏洞,安全合规。漏洞对比统计:新增漏洞 0 个,减少漏洞 0 个,持平 0 个。本次修改仅涉及 UI 调色板操作,不涉及用户输入处理、网络通信、文件操作或权限管理,无安全风险。 💡 改进建议代码示例// 当前修复代码已经合理,无需额外修改
// initStyleOption 方法中正确区分了 disabled 和 enabled 状态
qreal backgroundOpacity = 0.15;
if (option->state.testFlag(QStyle::State_Enabled)) {
if (option->state.testFlag(QStyle::State_Sunken)) {
backgroundOpacity = 0.25;
} else if (option->state.testFlag(QStyle::State_MouseOver)) {
backgroundOpacity = 0.2;
}
} else {
backgroundOpacity = 0.05; // disabled 状态使用更低透明度
}
if (m_highlighted) {
if (option->state.testFlag(QStyle::State_Enabled)) {
QColor textColor = option->palette.highlight().color();
option->palette.setColor(QPalette::ButtonText, textColor);
} else {
QColor textColor = option->palette.color(QPalette::Disabled, QPalette::ButtonText);
option->palette.setColor(QPalette::ButtonText, textColor);
}
}本报告由 AI 代码审查工具自动生成 |
|
已经修复此问题:bb8b7a67e24fc3bf246ea8bf3d15cbd68053e0d8,关闭 此PR |
修复 PMS BUG-360973
问题
免责声明对话框中"确定"按钮的活动色状态有误:未勾选协议时(disabled),按钮仍显示高亮文本色(看起来可点击);勾选协议后(enabled-normal),背景透明度与 disabled 状态相同(均为 0.15),用户无法从视觉上区分按钮是否可用。
根因
dde-license-dialog/src/content.cpp中自定义LicenseDialogButton::initStyleOption()存在两处缺陷:backgroundOpacity默认 0.15,enabled 分支仅在 sunken(0.25)/hover(0.2) 时覆盖,enabled-normal 回退到 0.15,与 disabled 完全相同。m_highlighted=true时无条件将ButtonText设为高亮色,disabled 的"确定"按钮仍显示高亮文本色。修复
在
initStyleOption中:State_Enabled时应用高亮文本色,disabled 时使用QPalette::Disabled的ButtonText色改动范围
仅修改
dde-license-dialog/src/content.cpp的initStyleOption方法,+9/-2 行,回归风险低。PMS
https://pms.uniontech.com/bug-view-360973.html
Summary by Sourcery
Fix the disclaimer dialog confirmation button’s disabled-state appearance.
Bug Fixes: