Skip to content

Conversation

@18202781743
Copy link
Contributor

Changed width calculation from hardcoded values to use
NotifyStyle.contentItem.width for consistent styling
Added proper scrollbar width calculation in NotifyCenter to account for
scrollbar presence
Updated main window width calculation to include proper padding handling
Fixed anchor margins and right constraints to ensure proper layout with
dynamic width
Added contentPadding property for better maintainability of spacing
values

Log: Fixed notification center layout issues with dynamic width
calculation

Influence:

  1. Test notification center display with different content widths
  2. Verify scrollbar appears correctly and doesn't cause layout issues
  3. Check that all notification items maintain consistent width
  4. Test window resizing behavior and content alignment
  5. Verify margins and padding are applied correctly on all sides

fix: 调整通知中心宽度计算方式

将硬编码的宽度值改为使用 NotifyStyle.contentItem.width 以确保样式一致性
在 NotifyCenter 中添加了正确的滚动条宽度计算以考虑滚动条的存在
更新了主窗口宽度计算以包含正确的内边距处理
修复了锚点边距和右侧约束以确保动态宽度下的正确布局
添加了 contentPadding 属性以便更好地维护间距值

Log: 修复了通知中心动态宽度计算导致的布局问题

Influence:

  1. 测试不同内容宽度下通知中心的显示效果
  2. 验证滚动条正确显示且不会导致布局问题
  3. 检查所有通知项是否保持一致的宽度
  4. 测试窗口调整大小行为和内容对齐
  5. 验证边距和内边距在所有边上是否正确应用

PMS: BUG-325871

Changed width calculation from hardcoded values to use
NotifyStyle.contentItem.width for consistent styling
Added proper scrollbar width calculation in NotifyCenter to account for
scrollbar presence
Updated main window width calculation to include proper padding handling
Fixed anchor margins and right constraints to ensure proper layout with
dynamic width
Added contentPadding property for better maintainability of spacing
values

Log: Fixed notification center layout issues with dynamic width
calculation

Influence:
1. Test notification center display with different content widths
2. Verify scrollbar appears correctly and doesn't cause layout issues
3. Check that all notification items maintain consistent width
4. Test window resizing behavior and content alignment
5. Verify margins and padding are applied correctly on all sides

fix: 调整通知中心宽度计算方式

将硬编码的宽度值改为使用 NotifyStyle.contentItem.width 以确保样式一致性
在 NotifyCenter 中添加了正确的滚动条宽度计算以考虑滚动条的存在
更新了主窗口宽度计算以包含正确的内边距处理
修复了锚点边距和右侧约束以确保动态宽度下的正确布局
添加了 contentPadding 属性以便更好地维护间距值

Log: 修复了通知中心动态宽度计算导致的布局问题

Influence:
1. 测试不同内容宽度下通知中心的显示效果
2. 验证滚动条正确显示且不会导致布局问题
3. 检查所有通知项是否保持一致的宽度
4. 测试窗口调整大小行为和内容对齐
5. 验证边距和内边距在所有边上是否正确应用

PMS: BUG-325871
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Sorry @18202781743, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@deepin-ci-robot
Copy link

deepin pr auto review

我对这个git diff进行了审查,以下是我的分析和改进建议:

1. 代码逻辑分析

主要变更集中在通知中心的宽度和布局调整上:

  • 将硬编码的宽度值(如360)替换为通过NotifyStyle定义的样式属性
  • 添加了滚动条相关的padding属性
  • 引入了DS.Style来处理滚动条样式
  • 调整了布局边距和内边距的处理方式

2. 语法改进

  • 所有硬编码的宽度值已被替换为样式属性,这是很好的做法
  • 引入了新的样式属性scrollBarPadding,使滚动条间距可配置

3. 代码质量改进

  • 使用了更灵活的样式系统,提高了代码的可维护性
  • 通过定义contentPadding属性统一管理内边距,使布局更一致
  • 分离了样式和逻辑,提高了代码的可读性

4. 性能优化

  • 使用样式属性而不是硬编码值,减少了重复代码
  • 通过统一的样式管理,便于后续的样式调整和优化

5. 安全性考虑

  • 没有发现明显的安全问题
  • 使用样式系统有助于避免因硬编码值导致的布局问题

6. 具体改进建议

  1. NotifyCenter.qml中:

    width: NotifyStyle.contentItem.width + DS.Style.scrollBar.padding + DS.Style.scrollBar.width + NotifyStyle.scrollBarPadding

    这个计算可能会在滚动条不可见时造成不必要的宽度增加。建议添加条件判断,只在滚动条可见时才添加其宽度。

  2. main.qml中:

    property int contentPadding: 20

    这个值应该放在样式文件中定义,而不是硬编码在组件中。

  3. 建议为滚动条样式添加更多的注释,说明其用途和计算方式。

  4. 考虑添加最大宽度和最小宽度的限制,以确保通知中心在不同屏幕尺寸下都能正常显示。

  5. 可以考虑添加响应式设计,使通知中心能够适应不同的屏幕尺寸。

  6. 建议为样式属性添加默认值,以防样式文件未正确加载时出现布局问题。

  7. NotifyStyle.qml中,建议为新增的属性添加注释说明其用途。

总的来说,这次修改提高了代码的可维护性和灵活性,但还有一些细节可以进一步优化,特别是在处理滚动条和响应式设计方面。

@deepin-ci-robot
Copy link

[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.

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
Copy link
Contributor Author

/forcemerge

@deepin-bot
Copy link

deepin-bot bot commented Sep 18, 2025

This pr force merged! (status: blocked)

@deepin-bot deepin-bot bot merged commit 831db9d into linuxdeepin:master Sep 18, 2025
7 of 10 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