Skip to content

Conversation

@Ivy233
Copy link
Contributor

@Ivy233 Ivy233 commented Jan 22, 2026

Adjust dock shadow configuration parameters:

  • Set shadowRadius to 40px for better visual effect
  • Set shadowOffset to (0, 0) for centered shadow
  • Set shadowColor alpha to 0.1 for lighter shadow

Task: BUG-331251

修复:调整任务栏阴影参数

调整任务栏阴影配置参数:

  • 设置 shadowRadius 为 40px 以获得更好的视觉效果
  • 设置 shadowOffset 为 (0, 0) 使阴影居中
  • 设置 shadowColor 透明度为 0.1 使阴影更轻

任务:BUG-331251

阴影-bloom-top 阴影-origin-top 阴影-vintage-top

Summary by Sourcery

Adjust dock window shadow settings to refine the taskbar’s visual appearance.

Bug Fixes:

  • Tune dock shadow color opacity to produce a lighter, less intrusive shadow around the taskbar.
  • Center the dock shadow and increase its blur radius for a more consistent and visually balanced appearance.

@sourcery-ai
Copy link

sourcery-ai bot commented Jan 22, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adjusts the dock window’s visual shadow parameters to use a lighter, centered, larger-radius shadow while preserving existing hide/show animation behavior and border toggling.

File-Level Changes

Change Details Files
Retune dock window shadow appearance for a lighter, centered, larger-radius shadow.
  • Decrease active shadow alpha from 0.6 to 0.1 while keeping full transparency during hide/show animation
  • Set shadow offset to (0, 0) so the shadow is centered around the dock window
  • Set shadow radius to 40 to increase the softness/spread of the dock shadow
panels/dock/package/main.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

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.

Hey - I've left some high level feedback:

  • The new shadowRadius, shadowOffset, and alpha values are hard-coded magic numbers; consider pulling them from a central theme/config or constants file so they can be reused and tuned without touching code.
  • Since the dock may be used on various display scales and themes, consider whether the fixed shadowRadius of 40 should be responsive (e.g., tied to DPI or panel height) to avoid overly large/small shadows on different setups.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new shadowRadius, shadowOffset, and alpha values are hard-coded magic numbers; consider pulling them from a central theme/config or constants file so they can be reused and tuned without touching code.
- Since the dock may be used on various display scales and themes, consider whether the fixed shadowRadius of 40 should be responsive (e.g., tied to DPI or panel height) to avoid overly large/small shadows on different setups.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

//D.DWindow.windowEffect: hideShowAnimation.running ? D.PlatformHandle.EffectNoShadow | D.PlatformHandle.EffectNoBorder : 0

// 目前直接处理shadowColor(透明和默认值的切换)和borderWidth(0和1的切换),来控制阴影和边框
// 默认阴影透明度是 60%,见: https://github.com/linuxdeepin/qt5platform-plugins/blob/master/xcb/dframewindow.h#L122
Copy link
Member

Choose a reason for hiding this comment

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

这个注释就不再有用了吧

Adjust dock shadow configuration parameters:
- Set shadowRadius to 40px for better visual effect
- Set shadowOffset to (0, 0) for centered shadow
- Set shadowColor alpha to 0.1 for lighter shadow

Task: BUG-331251

修复:调整任务栏阴影参数

调整任务栏阴影配置参数:
- 设置 shadowRadius 为 40px 以获得更好的视觉效果
- 设置 shadowOffset 为 (0, 0) 使阴影居中
- 设置 shadowColor 透明度为 0.1 使阴影更轻

任务:BUG-331251
@Ivy233 Ivy233 force-pushed the fix/dock-shadow-config branch from 7b9ab05 to abe92eb Compare January 22, 2026 06:36
@deepin-ci-robot
Copy link

deepin pr auto review

这段代码主要涉及 QML 中 Dock 面板窗口的阴影和边框属性设置。以下是对该 git diff 的详细审查,包括语法逻辑、代码质量、代码性能和代码安全方面的改进意见:

1. 语法逻辑审查

  • 逻辑正确性
    • 修改后的代码逻辑是合理的。在 hideShowAnimation.running 为真时(即隐藏/显示动画运行期间),将阴影颜色透明度设为 0,边框宽度设为 0,以去除阴影和边框,这符合动画过渡时的视觉需求。
    • 在非动画状态下,设置了具体的阴影参数(颜色、偏移、半径)和边框宽度,用于正常显示状态。
  • 硬编码数值
    • Qt.rgba(0, 0, 0, 0.1)shadowRadius: 40 是硬编码的数值。虽然这符合当前设计需求,但缺乏灵活性。如果未来设计风格变更,需要修改代码。
  • 注释与代码一致性
    • 注释提到“参数默认值见...”,但代码中实际使用的 shadowColor (0.1) 和 shadowRadius (40) 与链接中提到的默认值(通常是 0.6 和较小的半径)并不完全一致。这可能会让阅读者产生困惑,建议修改注释,说明当前数值是基于设计稿调整的,而非默认值。

2. 代码质量审查

  • 可读性与可维护性
    • 建议:将阴影相关的配置(颜色、偏移、半径)封装为一个单独的 QtObjectGroupProperty,或者定义为根对象的属性,这样可以在一个地方集中管理,提高代码的可读性和可维护性。
    • 示例
      property QtObject windowShadow: QtObject {
          readonly property color normalColor: Qt.rgba(0, 0, 0, 0.1)
          readonly property point offset: Qt.point(0, 0)
          readonly property int radius: 40
      }
      
      D.DWindow.shadowColor: hideShowAnimation.running ? "transparent" : windowShadow.normalColor
      D.DWindow.shadowOffset: windowShadow.offset
      D.DWindow.shadowRadius: windowShadow.radius
  • 魔法数字
    • 0.1, 40, 0, 1 都是“魔法数字”。建议将它们定义为具有语义的常量或属性,例如 shadowOpacity, shadowBlurRadius 等。

3. 代码性能审查

  • 属性绑定开销
    • Qt.rgbaQt.point 在每次绑定求值时都会创建新的对象。虽然这在 QML 属性绑定中很常见,但在高频更新的属性中可能会有轻微的性能开销。
    • 建议:如果这些属性不随时间变化,可以将它们定义为只读属性,避免重复创建对象。
    • 示例
      readonly property color transparentColor: Qt.rgba(0, 0, 0, 0)
      readonly property color normalShadowColor: Qt.rgba(0, 0, 0, 0.1)
      readonly property point zeroOffset: Qt.point(0, 0)
      
      D.DWindow.shadowColor: hideShowAnimation.running ? transparentColor : normalShadowColor
      D.DWindow.shadowOffset: zeroOffset
  • 动画性能
    • 在动画运行期间频繁切换阴影和边框属性可能会触发窗口的重绘和合成,尤其是在 Linux Deepin 的 DTK 环境下。
    • 建议:确保 hideShowAnimation 的持续时间适中,避免过短的动画导致频繁的属性切换,从而影响性能。

4. 代码安全审查

  • 平台兼容性
    • 代码中使用了 D.DWindow,这是 Deepin 特有的组件。在非 Deepin 环境(如标准 KDE Plasma 或 GNOME)下,这段代码可能无法正常工作或会被忽略。
    • 建议:虽然这是 Dock 面板,通常只在 Deepin 环境下运行,但为了代码的健壮性,可以添加平台检查或条件判断,尽管在这里可能不是必需的。
  • 外部链接依赖
    • 注释中包含指向 GitHub 的链接。如果仓库被移动或删除,链接将失效。
    • 建议:虽然这不是代码安全问题,但为了长期维护,建议在注释中简要说明关键参数的含义,而不仅仅依赖外部链接。

总结与建议修改后的代码

基于以上分析,建议对代码进行如下优化,以提高可读性、可维护性和性能:

Window {
    // ... 其他属性 ...

    // 定义阴影配置,集中管理,避免魔法数字
    readonly property color shadowColorTransparent: Qt.rgba(0, 0, 0, 0)
    readonly property color shadowColorNormal: Qt.rgba(0, 0, 0, 0.1) // 根据设计稿调整的不透明度
    readonly property point shadowOffsetNormal: Qt.point(0, 0)
    readonly property int shadowRadiusNormal: 40

    // 阴影和边框控制
    // 动画运行时去除阴影和边框,以保证动画流畅性
    D.DWindow.shadowColor: hideShowAnimation.running ? shadowColorTransparent : shadowColorNormal
    D.DWindow.shadowOffset: shadowOffsetNormal
    D.DWindow.shadowRadius: shadowRadiusNormal
    D.DWindow.borderWidth: hideShowAnimation.running ? 0 : 1
    
    // ... 其他属性 ...
}

主要改进点

  1. 将硬编码的数值提取为具有语义的只读属性。
  2. 集中管理阴影配置,便于后续调整。
  3. 更新注释,使其更准确地反映代码意图。
  4. 保持原有的逻辑,确保功能不变。

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: BLumia, Ivy233

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

@BLumia BLumia merged commit 36386d1 into linuxdeepin:master Jan 22, 2026
8 of 11 checks passed
@Ivy233 Ivy233 deleted the fix/dock-shadow-config branch January 22, 2026 06:43
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