fix: adjust window decoration button background opacity#724
Merged
deepin-bot[bot] merged 1 commit intolinuxdeepin:masterfrom Feb 2, 2026
Merged
fix: adjust window decoration button background opacity#724deepin-bot[bot] merged 1 commit intolinuxdeepin:masterfrom
deepin-bot[bot] merged 1 commit intolinuxdeepin:masterfrom
Conversation
Changed the background opacity of window decoration buttons from 5% to 10% for both light and dark themes. This adjustment improves the visual distinction of window control buttons (minimize, maximize, close) against the window background, enhancing user interface clarity and accessibility. Log: Improved visibility of window control buttons by increasing background opacity Influence: 1. Test window decoration buttons in both light and dark themes 2. Verify button visibility against various window backgrounds 3. Check hover and pressed states of window control buttons 4. Test with different window sizes and states (maximized, normal) 5. Verify consistency across different application windows fix: 调整窗口装饰器按钮背景透明度 将窗口装饰器按钮的背景透明度从5%调整为10%,适用于浅色和深色主题。这一调 整增强了窗口控制按钮(最小化、最大化、关闭)在窗口背景上的视觉区分度,提 升了用户界面的清晰度和可访问性。 Log: 通过增加背景透明度提高了窗口控制按钮的可见性 Influence: 1. 在浅色和深色主题下测试窗口装饰器按钮 2. 验证按钮在不同窗口背景下的可见性 3. 检查窗口控制按钮的悬停和按下状态 4. 测试不同窗口大小和状态(最大化、正常)下的显示效果 5. 验证不同应用程序窗口之间的一致性 PMS: BUG-302267
Contributor
deepin pr auto review这段代码修改主要涉及 Qt 界面绘制中的颜色透明度调整。以下是对该 1. 代码逻辑审查
2. 代码质量审查
3. 代码性能审查
4. 代码安全审查
总结与改进建议代码这段代码修改在功能上是正确的,能够实现加深颜色的目的。但从可维护性和规范性角度,建议进行如下优化: // 建议在类的头文件或全局常量定义处添加:
// static constexpr int ALPHA_CHANNEL_BASE = 255;
// static constexpr qreal WINDOW_BACKGROUND_OPACITY = 0.1;
// 修改后的代码片段:
void DStyle::drawPrimitive(const QStyle *style, DStyle::PrimitiveElement pe, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
{
// ... 其他代码 ...
if (/* 判断条件 */) {
QColor color;
DGuiApplicationHelper *guiAppHelp = DGuiApplicationHelper::instance();
// 建议增加断言确保单例有效性
Q_ASSERT(guiAppHelp);
// 使用常量替代魔法数字,并显式转换类型
const int alphaValue = static_cast<int>(ALPHA_CHANNEL_BASE * WINDOW_BACKGROUND_OPACITY);
if (guiAppHelp->themeType() == DGuiApplicationHelper::ColorType::DarkType) {
color = QColor(255, 255, 255, alphaValue);
} else {
color = QColor(0, 0, 0, alphaValue);
}
pa.setBrush(QPalette::Window, color);
}
// ... 其他代码 ...
} |
mhduiy
approved these changes
Feb 2, 2026
Contributor
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, 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 |
Contributor
Author
|
/forcemerge |
Contributor
|
This pr force merged! (status: blocked) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changed the background opacity of window decoration buttons from 5%
to 10% for both light and dark themes. This adjustment improves the
visual distinction of window control buttons (minimize, maximize, close)
against the window background, enhancing user interface clarity and
accessibility.
Log: Improved visibility of window control buttons by increasing
background opacity
Influence:
fix: 调整窗口装饰器按钮背景透明度
将窗口装饰器按钮的背景透明度从5%调整为10%,适用于浅色和深色主题。这一调
整增强了窗口控制按钮(最小化、最大化、关闭)在窗口背景上的视觉区分度,提
升了用户界面的清晰度和可访问性。
Log: 通过增加背景透明度提高了窗口控制按钮的可见性
Influence:
PMS: BUG-302267