Skip to content

feat: add window blur control to DialogWindow - #713

Merged
18202781743 merged 1 commit into
linuxdeepin:masterfrom
wjyrich:fix-bug-378325
Oct 20, 2026
Merged

18202781743 merged 1 commit into
linuxdeepin:masterfrom
wjyrich:fix-bug-378325

Conversation

@wjyrich

@wjyrich wjyrich commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor
  1. Add enableBehindWindowBlur property to DialogWindow with default true
  2. Bind StyledBehindWindowBlur visibility to this new property
  3. Disable behind window blur in SettingsDialog for better performance
  4. Set SettingsDialog background to palette.base instead of transparent
  5. Add rounded corner styling to SettingsDialog content background
  6. Enable clipping on navigation and content ListViews to prevent overflow
  7. Restructure content padding using individual padding properties

Log: Added blur control option for dialog windows and improved settings dialog appearance

Influence:

  1. Test dialog windows with blur enabled/disabled to verify visual effects
  2. Verify SettingsDialog displays correctly without blur effect
  3. Check rounded corner appearance on settings content background
  4. Test navigation list scrolling with clip enabled
  5. Verify content list scrolling behavior with clip property
  6. Test dialog window on different platforms for blur compatibility
  7. Verify padding changes don't break layout on various screen sizes

feat: 为 DialogWindow 添加窗口模糊控制

  1. 为 DialogWindow 添加 enableBehindWindowBlur 属性,默认值为 true
  2. 将 StyledBehindWindowBlur 的可见性绑定到新属性
  3. 在 SettingsDialog 中禁用窗口后模糊以提升性能
  4. 将 SettingsDialog 背景设置为 palette.base 而非透明
  5. 为 SettingsDialog 内容背景添加圆角样式
  6. 启用导航和内容 ListView 的裁剪以防止溢出
  7. 使用独立的内边距属性重构内容布局

Log: 新增对话框窗口模糊控制选项并改进设置对话框外观

Influence:

  1. 测试启用/禁用模糊效果的对话框窗口,验证视觉效果
  2. 验证 SettingsDialog 在无模糊效果下的显示是否正确
  3. 检查设置内容背景的圆角外观
  4. 测试启用裁剪后的导航列表滚动
  5. 验证内容列表在裁剪属性下的滚动行为
  6. 在不同平台上测试对话框窗口的模糊兼容性
  7. 验证内边距更改不会在各种屏幕尺寸下破坏布局

PMS: BUG-378325

Summary by Sourcery

Improve dialog window flexibility and refine the SettingsDialog appearance and layout.

New Features:

  • Add configurable behind-window blur support to dialog windows, enabled by default.

Bug Fixes:

  • Prevent navigation and settings content from overflowing their scrollable areas.

Enhancements:

  • Disable blur for SettingsDialog and refine its layout, background, rounded content styling, sizing, and padding behavior.

@sourcery-ai

sourcery-ai Bot commented Sep 29, 2026

Copy link
Copy Markdown

Reviewer's Guide

Introduces configurable behind-window blur for DialogWindow and uses it to optimize SettingsDialog, while refining its background, rounded-corner presentation, list clipping, and content layout padding.

File-Level Changes

Change Details Files
Adds an opt-in control for the dialog’s behind-window blur effect.
  • Introduces enableBehindWindowBlur with a default of true.
  • Binds the blur component’s visibility to the new property.
qt6/src/qml/DialogWindow.qml
Optimizes and restyles the settings dialog for a non-blurred presentation.
  • Disables behind-window blur and uses the base palette color for the window.
  • Adds a layered palette-based background with rounded corners.
  • Enables clipping on navigation and content lists.
  • Replaces aggregate content padding with explicit side-specific padding and adjusts content height.
qt6/src/qml/settings/SettingsDialog.qml

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 1 issue

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

## Individual Comments

### Comment 1
<location path="qt6/src/qml/settings/SettingsDialog.qml" line_range="63" />
<code_context>
             top: control.top
         }
-        padding: DS.Style.settings.content.margin
+        height: Math.max(0, control.height - parent.y)
+        leftPadding: DS.Style.settings.content.margin
+        rightPadding: DS.Style.settings.content.margin
</code_context>
<issue_to_address>
**issue (bug_risk):** `contentBg.height` creates a binding loop: `DialogWindow.height` is bound to `content.height`, `content.height` is derived from its children's bounds, and `contentBg.height` is bound back to `control.height`. QML reports a binding loop and the settings content height becomes unstable or resolves incorrectly, causing the dialog layout to collapse or display at the wrong height.

**Triggers:** When SettingsDialog is instantiated and its window size is evaluated.

**Suggested fix:** Give the content view a height derived from an independent parent/content height, or establish an explicit dialog height without binding the child height back to `control.height`.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread qt6/src/qml/settings/SettingsDialog.qml Outdated
Comment thread qt6/src/qml/settings/SettingsDialog.qml Outdated
Comment thread qt6/src/qml/settings/SettingsDialog.qml Outdated
Comment thread qt6/src/qml/DialogWindow.qml Outdated
Comment thread qt6/src/qml/settings/SettingsDialog.qml Outdated
Comment thread qt6/src/qml/settings/SettingsDialog.qml Outdated
// DialogWindow sizes its content container from children. Keep its header/title
// offset via this marker while anchoring the scrollable layout to the window.
RowLayout {
parent: control.contentItem

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

指定它的parent,是为啥呀,能指定边距?

Comment thread qt6/src/qml/settings/SettingsDialog.qml Outdated
Comment thread qt6/src/qml/DialogWindow.qml Outdated
property bool enableBehindWindowBlur: true
color: enableBehindWindowBlur ? "transparent" : palette.base
height: layout.implicitHeight
width: minimumWidth

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

宽度设置为minimumWidth有啥说法么?


Item {
id: content
anchors.fill: parent

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这样写真的没有循环的问题么?
测下其它的场景吧,

@deepin-bot

deepin-bot Bot commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

TAG Bot

New tag: 6.7.51
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #723

Comment thread qt6/src/qml/settings/SettingsDialog.qml Outdated
1. Add enableBehindWindowBlur property to DialogWindow with default true
2. Bind StyledBehindWindowBlur visibility to this new property
3. Disable behind window blur in SettingsDialog for better performance
4. Set SettingsDialog background to palette.base instead of transparent
5. Add rounded corner styling to SettingsDialog content background
6. Enable clipping on navigation and content ListViews to prevent
overflow
7. Restructure content padding using individual padding properties

Log: Added blur control option for dialog windows and improved settings
dialog appearance

Influence:
1. Test dialog windows with blur enabled/disabled to verify visual
effects
2. Verify SettingsDialog displays correctly without blur effect
3. Check rounded corner appearance on settings content background
4. Test navigation list scrolling with clip enabled
5. Verify content list scrolling behavior with clip property
6. Test dialog window on different platforms for blur compatibility
7. Verify padding changes don't break layout on various screen sizes

feat: 为 DialogWindow 添加窗口模糊控制

1. 为 DialogWindow 添加 enableBehindWindowBlur 属性,默认值为 true
2. 将 StyledBehindWindowBlur 的可见性绑定到新属性
3. 在 SettingsDialog 中禁用窗口后模糊以提升性能
4. 将 SettingsDialog 背景设置为 palette.base 而非透明
5. 为 SettingsDialog 内容背景添加圆角样式
6. 启用导航和内容 ListView 的裁剪以防止溢出
7. 使用独立的内边距属性重构内容布局

Log: 新增对话框窗口模糊控制选项并改进设置对话框外观

Influence:
1. 测试启用/禁用模糊效果的对话框窗口,验证视觉效果
2. 验证 SettingsDialog 在无模糊效果下的显示是否正确
3. 检查设置内容背景的圆角外观
4. 测试启用裁剪后的导航列表滚动
5. 验证内容列表在裁剪属性下的滚动行为
6. 在不同平台上测试对话框窗口的模糊兼容性
7. 验证内边距更改不会在各种屏幕尺寸下破坏布局

PMS: BUG-378325
@deepin-ci-robot

Copy link
Copy Markdown
Contributor

deepin pr auto review

🤖 AI 代码审查报告

总体评分: 99 分 (通过阈值: 70分)

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 代码变更质量优秀,7项需求全部实现,无安全漏洞。Loader条件加载模式提升了性能,RowLayout重构改善了代码结构。仅有1处轻微代码质量建议(缺少属性注释)。
PR信息 linuxdeepin/dtkdeclarative#713
提交信息 feat: add window blur control to DialogWindow
作者 wjyrich
分支 fix-bug-378325 → master
修改文件 2个(DialogWindow.qml, SettingsDialog.qml)
变更行数 +88 / -60
关联PMS BUG-378325

🔍 详细分析

1. 语法逻辑 ✅

评价: 语法正确,逻辑清晰 ✅ 通过

评分: 25/25

分析内容:

DialogWindow.qml

  • 新增 property bool enableBehindWindowBlur: true 属性声明语法正确
  • color: enableBehindWindowBlur ? "transparent" : palette.base 三元表达式逻辑正确,根据模糊开关条件设置窗口颜色
  • height: content.implicitHeight / width: content.implicitWidth 改用 implicit 属性,避免了 content.height / content.width 可能引发的绑定循环
  • Loader 条件加载 StyledBehindWindowBlur 模式规范,active: control.enableBehindWindowBlur 绑定正确
  • control: Window.window 使用附加属性获取窗口引用,比原有 control: control 更健壮
  • Layout.preferredWidth: item ? item.implicitWidth : 0 正确处理了 Loader item 为 null 的情况
  • visible: active 在 Loader 上的设置确保非活动状态时不占用布局空间

SettingsDialog.qml

  • RowLayout 嵌套 ScrollView 结构语法正确
  • Layout.preferredWidth / Layout.fillHeight / Layout.fillWidth 布局属性使用规范
  • 嵌套 Rectangle 实现圆角背景的 QML 模式正确
  • onCurrentIndexChanged 信号处理逻辑保持不变,双向同步正确
  • clip: true 在 ListView 上的设置语法正确

潜在问题:
✅ 未发现明显问题


2. 代码质量 ✅

评价: 代码结构清晰,注释完整 ✅ 通过

评分: 24/25

分析内容:

代码结构

  • DialogWindow.qml 的 Loader 条件加载模式将模糊效果组件化,结构清晰
  • SettingsDialog.qml 从 anchor 布局重构为 RowLayout,代码可读性显著提升
  • 嵌套 Rectangle 模式实现了圆角背景与内容区域分色,结构合理

注释完整性

  • 已有注释保留完整(如 onClosing 中的 PMS Bug 说明)
  • 属性命名自文档化(enableBehindWindowBlur 语义明确)

代码重复

  • 无重复代码

调试信息

  • 无残留调试代码

需求匹配度

  • 7项需求全部实现,匹配率 100%
    1. ✅ 添加 enableBehindWindowBlur 属性,默认 true(DialogWindow.qml:24)
    2. ✅ 将 StyledBehindWindowBlur 可见性绑定到新属性(DialogWindow.qml:39)
    3. ✅ 在 SettingsDialog 中禁用窗口模糊(SettingsDialog.qml:14)
    4. ✅ 设置 SettingsDialog 背景为 palette.base(SettingsDialog.qml:76)
    5. ✅ 添加圆角样式(SettingsDialog.qml:67)
    6. ✅ 启用 ListView 裁剪防止溢出(SettingsDialog.qml:45,83)
    7. ✅ 使用独立内边距属性重构内容布局(SettingsDialog.qml:60-63)

潜在问题:

  1. qt6/src/qml/DialogWindow.qml:24 - 新增属性 enableBehindWindowBlur 缺少简要注释说明其设计目的和默认值选择原因,建议在属性声明上方添加注释

建议: 在 enableBehindWindowBlur 属性上方添加简要注释,说明该属性用于控制对话框窗口背景模糊效果的开关


3. 代码性能 ✅

评价: 性能良好,资源使用合理 ✅ 通过

评分: 20/20

分析内容:

性能改进

  • 使用 Loader + active 绑定替代直接实例化 StyledBehindWindowBlur,仅在需要时创建模糊组件实例,SettingsDialog 中禁用模糊时可完全释放该组件的资源
  • 改用 implicitWidth / implicitHeight 替代 width / height 避免了潜在的 QML 绑定循环,绑定循环会导致额外的属性更新开销
  • Layout.fillHeight: true 在 contentLoader 上的设置使内容区域正确填充剩余空间,避免了不必要的尺寸计算

资源使用

  • clip: true 在 ListView 上的开销可忽略(Qt 场景图原生支持裁剪),且为防止内容溢出的必要修正
  • 嵌套 Rectangle 增加一层渲染节点,但为圆角背景效果的必要实现,开销可接受
  • Loader 在 active: false 时不会创建 sourceComponent 实例,节省内存

潜在问题:
✅ 未发现明显问题


4. 代码安全 🔒

评价: 存在0个安全漏洞,安全合规 ✅ 通过

评分: 30/30

分析内容:

安全审查

  • 本次变更为纯 QML UI 代码,不涉及用户输入处理、网络操作、文件系统访问、命令执行或加密操作
  • 属性绑定和信号处理均为内部组件通信,无外部输入注入风险
  • settingsContainer.resetSettings() 调用为内部重置操作,无安全风险
  • qsTr("Restore Defaults") 为国际化文本,无注入风险

漏洞对比统计:新增漏洞 0 个,减少漏洞 0 个,持平 0 个

安全漏洞详情:
✅ 未发现安全漏洞

建议: 无需安全加固


💡 改进建议代码示例

// DialogWindow.qml - 建议在属性声明上方添加注释
// Controls whether behind-window blur effect is enabled.
// When disabled, the window uses palette.base as background color instead of transparent.
property bool enableBehindWindowBlur: true

📋 审查检查清单

  • 已按四维度标准完成代码分析(语法逻辑、代码质量、代码性能、代码安全)
  • 代码安全维度第一行包含"存在0个安全漏洞"
  • 安全漏洞已按等级分类(无漏洞)
  • 包含漏洞对比统计行(新增0/减少0/持平0)
  • 每个维度标记✓/✕与评价词一致
  • 审查结论考虑了 commit message 的目的
  • 问题定位准确,行号和函数名正确
  • 环境变量使用正确,文件路径无误

本报告由 AI 代码审查工具自动生成
审查时间: 2026-10-20
分析模式: 全量分析 (GitHub PR)

@deepin-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743, wjyrich

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

@18202781743
18202781743 merged commit 3d00a9d into linuxdeepin:master Oct 20, 2026
19 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants