Skip to content

Conversation

@qxp930712
Copy link

@qxp930712 qxp930712 commented Feb 9, 2026

  1. Replaced D.BoxShadow and D.BoxInsetShadow components with D.InsideBoxBorder and D.OutsideBoxBorder in display mode and window effect panels
  2. Added new color palette properties for inside and outside borders with checked and normal states
  3. Adjusted background color darkness in dark mode from 0.6 to 0.5 for better contrast
  4. Added D.OutsideBoxBorder component to main OSD window
  5. Removed obsolete dropShadowColor and innerShadowColor palette properties

This change transitions from shadow-based visual effects to border-based effects for clearer definition of UI elements while maintaining visual hierarchy. Border effects provide better visibility across different themes and improve rendering performance.

Log: Updated OSD notification visual style with borders replacing shadows for better clarity and theme consistency

Influence:

  1. Test OSD notifications in both light and dark modes to verify border visibility
  2. Verify selected and unselected states show proper border colors
  3. Check display mode switching and ensure visual consistency
  4. Test window effects and notification popups for proper border rendering
  5. Verify that the changes don't affect touch interactions or responsiveness
  6. Confirm that the visual hierarchy remains clear with the new border effects

PMS: BUG-311255

Summary by Sourcery

Update OSD notification visuals to use border-based styling instead of shadow-based effects for clearer, more consistent appearance across themes.

New Features:

  • Introduce inside and outside border components for OSD display mode and window effect items, including distinct palettes for checked and normal states.
  • Add an outside border around the main OSD window to visually separate it from the background.

Bug Fixes:

  • Improve visual clarity and theme consistency of OSD notifications by replacing shadow-based highlights with border-based styling.

Enhancements:

  • Adjust dark-mode checked background opacity to improve contrast and readability.
  • Remove obsolete shadow-related palette properties now replaced by border color palettes.

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: qxp930712

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

@sourcery-ai
Copy link

sourcery-ai bot commented Feb 9, 2026

Reviewer's Guide

This PR updates OSD notification visuals to use inside/outside border components instead of shadow components, adds corresponding border palettes for checked/normal and light/dark themes, slightly tweaks dark-mode background opacity, and wires the new border styling into the main OSD window.

Class diagram for updated OSD notification border styling

classDiagram
    class OSDWindow {
        +D.Palette insideBorderColor
        +D.Palette outsideBorderColor
        +real windowRadius
    }

    class DisplayModeItem {
        +bool isCurrent
        +D.Palette backgroundColor
        +D.Palette checkedBackgroundColor
        +D.Palette insideBorderColor
        +D.Palette checkedInsideBorderColor
        +D.Palette outsideBorderColor
        +D.Palette checkedOutsideBorderColor
    }

    class WindowEffectItem {
        +bool isCurrent
        +D.Palette backgroundColor
        +D.Palette checkedBackgroundColor
        +D.Palette insideBorderColor
        +D.Palette checkedInsideBorderColor
        +D.Palette outsideBorderColor
        +D.Palette checkedOutsideBorderColor
    }

    class D_InsideBoxBorder {
        +real radius
        +D.Palette color
    }

    class D_OutsideBoxBorder {
        +real radius
        +D.Palette color
    }

    class D_BoxShadow {
        -real shadowOffsetX
        -real shadowOffsetY
        -real shadowBlur
        -real cornerRadius
        -real spread
        -D.Palette shadowColor
        -bool hollow
    }

    class D_BoxInsetShadow {
        -real shadowOffsetX
        -real shadowOffsetY
        -real shadowBlur
        -real cornerRadius
        -real spread
        -D.Palette shadowColor
    }

    class D_Palette {
        +color normal
        +color normalDark
    }

    OSDWindow --> D_InsideBoxBorder : uses
    OSDWindow --> D_OutsideBoxBorder : uses

    DisplayModeItem --> D_InsideBoxBorder : uses
    DisplayModeItem --> D_OutsideBoxBorder : uses
    DisplayModeItem --> D_Palette : uses palettes

    WindowEffectItem --> D_InsideBoxBorder : uses
    WindowEffectItem --> D_OutsideBoxBorder : uses
    WindowEffectItem --> D_Palette : uses palettes

    D_BoxShadow ..x DisplayModeItem : removed
    D_BoxInsetShadow ..x DisplayModeItem : removed
    D_BoxShadow ..x WindowEffectItem : removed
    D_BoxInsetShadow ..x WindowEffectItem : removed
Loading

Flow diagram for OSD item border color selection

flowchart TD
    A[OSD item to render] --> B{isCurrent}
    B -- true --> C[Use checked palettes]
    B -- false --> D[Use normal palettes]

    C --> E{Theme}
    D --> E

    E -- Light mode --> F[Background color = checkedBackgroundColor.normal or backgroundColor.normal]
    E -- Dark mode --> G[Background color = checkedBackgroundColor.normalDark or backgroundColor.normalDark]

    C --> H[Inside border color = checkedInsideBorderColor]
    C --> I[Outside border color = checkedOutsideBorderColor]

    D --> J[Inside border color = insideBorderColor]
    D --> K[Outside border color = outsideBorderColor]

    F --> L[Render D_InsideBoxBorder with chosen inside border color]
    G --> L
    H --> L
    J --> L

    F --> M[Render D_OutsideBoxBorder with chosen outside border color]
    G --> M
    I --> M
    K --> M
Loading

File-Level Changes

Change Details Files
Replace shadow-based selection visuals in OSD display mode items with border-based visuals and adjust dark-mode background opacity.
  • Change checkedBackgroundColor.normalDark from rgba(0,0,0,0.6) to rgba(0,0,0,0.5) for better dark-mode contrast.
  • Remove dropShadowColor and innerShadowColor palettes no longer needed for shadows.
  • Replace D.BoxShadow and D.BoxInsetShadow with D.InsideBoxBorder and D.OutsideBoxBorder around the item background rectangle.
  • Introduce insideBorderColor/checkedInsideBorderColor and outsideBorderColor/checkedOutsideBorderColor palettes driving the new border components based on selection state.
panels/notification/osd/displaymode/package/main.qml
Apply the same border-based selection styling to OSD window effect items, mirroring the display mode changes.
  • Adjust checkedBackgroundColor.normalDark to rgba(0,0,0,0.5) for dark mode.
  • Remove obsolete dropShadowColor and innerShadowColor palettes for window effect items.
  • Swap D.BoxShadow and D.BoxInsetShadow for D.InsideBoxBorder and D.OutsideBoxBorder anchored to the item background.
  • Define insideBorderColor/checkedInsideBorderColor and outsideBorderColor/checkedOutsideBorderColor palettes and use them conditionally on isCurrent.
panels/notification/osd/windoweffect/package/main.qml
Add an outer border around the main OSD window to match the new border-based visual language.
  • Keep existing D.InsideBoxBorder on the OSD root window using D.ColorSelector.insideBorderColor.
  • Introduce D.OutsideBoxBorder on the OSD root window with a new outsideBorderColor palette tuned for light/dark modes.
  • Anchor the outer border to fill the window, use root.windowRadius for radius, and place it above content via D.DTK.AboveOrder.
panels/notification/osd/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 found 5 issues, and left some high level feedback:

  • The new inside/outside border palettes are defined inline in multiple QML files with identical values; consider centralizing these palette definitions in a shared place (e.g., on the ColorSelector or a helper component) to avoid duplication and keep future visual tweaks consistent.
  • Previously the shadows were hidden for the current item (visible: !itemView.isCurrent), but the new borders are always drawn and only change color; verify this behavior matches the intended spec, or reintroduce conditional visibility if the current item should remain borderless.
  • The new D.OutsideBoxBorder on the main OSD window is anchored to the full window and rendered above content (z: D.DTK.AboveOrder); ensure it does not interfere with hit-testing or clipping of child controls, and adjust its z-order or enabled/visible properties if needed.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new inside/outside border palettes are defined inline in multiple QML files with identical values; consider centralizing these palette definitions in a shared place (e.g., on the ColorSelector or a helper component) to avoid duplication and keep future visual tweaks consistent.
- Previously the shadows were hidden for the current item (`visible: !itemView.isCurrent`), but the new borders are always drawn and only change color; verify this behavior matches the intended spec, or reintroduce conditional visibility if the current item should remain borderless.
- The new `D.OutsideBoxBorder` on the main OSD window is anchored to the full window and rendered above content (`z: D.DTK.AboveOrder`); ensure it does not interfere with hit-testing or clipping of child controls, and adjust its z-order or `enabled`/`visible` properties if needed.

## Individual Comments

### Comment 1
<location> `panels/notification/osd/displaymode/package/main.qml:121-130` </location>
<code_context>
+                D.InsideBoxBorder {
</code_context>

<issue_to_address>
**issue (bug_risk):** ColorSelector references for inside border palettes appear to be undefined or misplaced.

`insideBorderColor` and `checkedInsideBorderColor` are defined on `D.InsideBoxBorder`, but the binding uses `D.ColorSelector.checkedInsideBorderColor` / `D.ColorSelector.insideBorderColor`. Unless `ColorSelector` is extended elsewhere with these properties, this will resolve to `undefined` or bypass the local palettes. Either move these properties into `D.ColorSelector` with the other colors, or bind directly to the local properties (e.g. `color: itemView.isCurrent ? checkedInsideBorderColor : insideBorderColor`).
</issue_to_address>

### Comment 2
<location> `panels/notification/osd/displaymode/package/main.qml:135-144` </location>
<code_context>
         color: D.ColorSelector.insideBorderColor
     }

+    D.OutsideBoxBorder {
+        property D.Palette outsideBorderColor: D.Palette {
+            normal: Qt.rgba(0, 0, 0, 0.1)
+            normalDark: Qt.rgba(0, 0, 0, 0.7)
+        }
+        radius: root.windowRadius
+        anchors.fill: parent
+        z: D.DTK.AboveOrder
+        color: D.ColorSelector.outsideBorderColor
+    }
+
     Control {
         property D.Palette textColor: D.Palette {
             normal: Qt.rgba(0, 0, 0, 1)
diff --git a/panels/notification/osd/windoweffect/package/main.qml b/panels/notification/osd/windoweffect/package/main.qml
index 560fc13d8..d2670c72e 100644
--- a/panels/notification/osd/windoweffect/package/main.qml
+++ b/panels/notification/osd/windoweffect/package/main.qml
</code_context>

<issue_to_address>
**issue (bug_risk):** Outside border palettes are defined on the border item but bound via ColorSelector, which likely has no such properties.

`outsideBorderColor` and `checkedOutsideBorderColor` are defined on `D.OutsideBoxBorder`, but the binding still points to `D.ColorSelector.*`. Unless `ColorSelector` defines these properties, the new palettes won’t be used. Please either add these properties to `ColorSelector` or bind `color` directly to the local `D.OutsideBoxBorder` properties.
</issue_to_address>

### Comment 3
<location> `panels/notification/osd/windoweffect/package/main.qml:170-179` </location>
<code_context>
+                D.InsideBoxBorder {
</code_context>

<issue_to_address>
**issue (bug_risk):** Same potential mismatch between local inside border palettes and ColorSelector references as in displaymode.

The palettes `insideBorderColor` / `checkedInsideBorderColor` are defined on `D.InsideBoxBorder`, but the `color` binding uses `D.ColorSelector.*`, matching the inconsistent pattern in `displaymode/package/main.qml`. Please either move these palettes into `ColorSelector` or bind directly to the local border properties to avoid the mismatch.
</issue_to_address>

### Comment 4
<location> `panels/notification/osd/windoweffect/package/main.qml:184-193` </location>
<code_context>
         color: D.ColorSelector.insideBorderColor
     }

+    D.OutsideBoxBorder {
+        property D.Palette outsideBorderColor: D.Palette {
+            normal: Qt.rgba(0, 0, 0, 0.1)
+            normalDark: Qt.rgba(0, 0, 0, 0.7)
+        }
+        radius: root.windowRadius
+        anchors.fill: parent
+        z: D.DTK.AboveOrder
+        color: D.ColorSelector.outsideBorderColor
+    }
+
     Control {
         property D.Palette textColor: D.Palette {
             normal: Qt.rgba(0, 0, 0, 1)
diff --git a/panels/notification/osd/windoweffect/package/main.qml b/panels/notification/osd/windoweffect/package/main.qml
index 560fc13d8..d2670c72e 100644
--- a/panels/notification/osd/windoweffect/package/main.qml
+++ b/panels/notification/osd/windoweffect/package/main.qml
</code_context>

<issue_to_address>
**issue (bug_risk):** Outside border color binding likely does not use the newly defined palettes on the border item.

Because `outsideBorderColor` and `checkedOutsideBorderColor` are defined on `D.OutsideBoxBorder` but the `color` binding uses `D.ColorSelector.outsideBorderColor`, the new palettes likely won’t apply unless `ColorSelector` forwards these properties. Please either bind `color` to the local properties or move the palette definitions into the `ColorSelector` configuration so they are actually used.
</issue_to_address>

### Comment 5
<location> `panels/notification/osd/package/main.qml:75-83` </location>
<code_context>
                 }
-                D.BoxInsetShadow {
-                    visible: !itemView.isCurrent
+                D.OutsideBoxBorder {
+                    property D.Palette outsideBorderColor: D.Palette {
+                        normal: Qt.rgba(0, 0, 0, 0.05)
</code_context>

<issue_to_address>
**issue (bug_risk):** OutsideBoxBorder defines its own outsideBorderColor palette but uses ColorSelector for the binding.

Here you declare a local `outsideBorderColor` palette, but `color` is still bound to `D.ColorSelector.outsideBorderColor`. If `ColorSelector` doesn’t expose this property, the color may be `undefined` and won’t use the local palette. To align with the inside border and the local definition, bind `color` to the local `outsideBorderColor` (or move this palette into `ColorSelector` if that’s the intended source).
</issue_to_address>

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.

Comment on lines +121 to +130
D.InsideBoxBorder {
property D.Palette insideBorderColor: D.Palette {
normal: Qt.rgba(1, 1, 1, 0.1)
normalDark: Qt.rgba(1, 1, 1, 0.05)
}
property D.Palette checkedInsideBorderColor: D.Palette {
normal: Qt.rgba(1, 1, 1, 0.15)
normalDark: Qt.rgba(1, 1, 1, 0.08)
}
radius: backgroundRect.radius
Copy link

Choose a reason for hiding this comment

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

issue (bug_risk): ColorSelector references for inside border palettes appear to be undefined or misplaced.

insideBorderColor and checkedInsideBorderColor are defined on D.InsideBoxBorder, but the binding uses D.ColorSelector.checkedInsideBorderColor / D.ColorSelector.insideBorderColor. Unless ColorSelector is extended elsewhere with these properties, this will resolve to undefined or bypass the local palettes. Either move these properties into D.ColorSelector with the other colors, or bind directly to the local properties (e.g. color: itemView.isCurrent ? checkedInsideBorderColor : insideBorderColor).

Comment on lines +135 to +144
D.OutsideBoxBorder {
property D.Palette outsideBorderColor: D.Palette {
normal: Qt.rgba(0, 0, 0, 0.05)
normalDark: Qt.rgba(0, 0, 0, 0.4)
}
property D.Palette checkedOutsideBorderColor: D.Palette {
normal: Qt.rgba(0, 0, 0, 0.1)
normalDark: Qt.rgba(0, 0, 0, 0.45)
}
radius: backgroundRect.radius
Copy link

Choose a reason for hiding this comment

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

issue (bug_risk): Outside border palettes are defined on the border item but bound via ColorSelector, which likely has no such properties.

outsideBorderColor and checkedOutsideBorderColor are defined on D.OutsideBoxBorder, but the binding still points to D.ColorSelector.*. Unless ColorSelector defines these properties, the new palettes won’t be used. Please either add these properties to ColorSelector or bind color directly to the local D.OutsideBoxBorder properties.

Comment on lines +170 to +179
D.InsideBoxBorder {
property D.Palette insideBorderColor: D.Palette {
normal: Qt.rgba(1, 1, 1, 0.1)
normalDark: Qt.rgba(1, 1, 1, 0.05)
}
property D.Palette checkedInsideBorderColor: D.Palette {
normal: Qt.rgba(1, 1, 1, 0.15)
normalDark: Qt.rgba(1, 1, 1, 0.08)
}
radius: backgroundRect.radius
Copy link

Choose a reason for hiding this comment

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

issue (bug_risk): Same potential mismatch between local inside border palettes and ColorSelector references as in displaymode.

The palettes insideBorderColor / checkedInsideBorderColor are defined on D.InsideBoxBorder, but the color binding uses D.ColorSelector.*, matching the inconsistent pattern in displaymode/package/main.qml. Please either move these palettes into ColorSelector or bind directly to the local border properties to avoid the mismatch.

Comment on lines +184 to +193
D.OutsideBoxBorder {
property D.Palette outsideBorderColor: D.Palette {
normal: Qt.rgba(0, 0, 0, 0.05)
normalDark: Qt.rgba(0, 0, 0, 0.4)
}
property D.Palette checkedOutsideBorderColor: D.Palette {
normal: Qt.rgba(0, 0, 0, 0.1)
normalDark: Qt.rgba(0, 0, 0, 0.45)
}
radius: backgroundRect.radius
Copy link

Choose a reason for hiding this comment

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

issue (bug_risk): Outside border color binding likely does not use the newly defined palettes on the border item.

Because outsideBorderColor and checkedOutsideBorderColor are defined on D.OutsideBoxBorder but the color binding uses D.ColorSelector.outsideBorderColor, the new palettes likely won’t apply unless ColorSelector forwards these properties. Please either bind color to the local properties or move the palette definitions into the ColorSelector configuration so they are actually used.

Comment on lines 75 to 83
D.OutsideBoxBorder {
property D.Palette outsideBorderColor: D.Palette {
normal: Qt.rgba(0, 0, 0, 0.1)
normalDark: Qt.rgba(0, 0, 0, 0.7)
}
radius: root.windowRadius
anchors.fill: parent
z: D.DTK.AboveOrder
color: D.ColorSelector.outsideBorderColor
Copy link

Choose a reason for hiding this comment

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

issue (bug_risk): OutsideBoxBorder defines its own outsideBorderColor palette but uses ColorSelector for the binding.

Here you declare a local outsideBorderColor palette, but color is still bound to D.ColorSelector.outsideBorderColor. If ColorSelector doesn’t expose this property, the color may be undefined and won’t use the local palette. To align with the inside border and the local definition, bind color to the local outsideBorderColor (or move this palette into ColorSelector if that’s the intended source).

}
D.BoxShadow {
visible: !itemView.isCurrent
D.InsideBoxBorder {
Copy link
Contributor

Choose a reason for hiding this comment

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

不要阴影了?

color: D.ColorSelector.insideBorderColor
}

D.OutsideBoxBorder {
Copy link
Contributor

Choose a reason for hiding this comment

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

这个真的有效果么?这都超出窗口了吧,它应该显示不了吧,

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the OSD notification UI styling to replace shadow-based effects with inside/outside border components, aiming for clearer visual separation across light/dark themes and improved rendering consistency.

Changes:

  • Replace D.BoxShadow / D.BoxInsetShadow with D.InsideBoxBorder / D.OutsideBoxBorder in display mode and window effect item delegates.
  • Add checked/normal border palettes for inside and outside borders, and tweak dark-mode checked background opacity (0.6 → 0.5).
  • Add an D.OutsideBoxBorder around the main OSD window.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
panels/notification/osd/displaymode/package/main.qml Replaces delegate shadows with inside/outside borders and updates checked background dark alpha.
panels/notification/osd/windoweffect/package/main.qml Same border-based styling update for window effect delegates + checked background dark alpha tweak.
panels/notification/osd/package/main.qml Adds an outside border around the OSD window container.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +121 to +140
D.InsideBoxBorder {
property D.Palette insideBorderColor: D.Palette {
normal: Qt.rgba(1, 1, 1, 0.1)
normalDark: Qt.rgba(1, 1, 1, 0.05)
}
property D.Palette checkedInsideBorderColor: D.Palette {
normal: Qt.rgba(1, 1, 1, 0.15)
normalDark: Qt.rgba(1, 1, 1, 0.08)
}
radius: backgroundRect.radius
anchors.fill: parent
shadowOffsetX: 0
shadowOffsetY: 1
shadowColor: itemView.D.ColorSelector.dropShadowColor
shadowBlur: 1
cornerRadius: backgroundRect.radius
spread: 0
hollow: true
color: itemView.isCurrent ? D.ColorSelector.checkedInsideBorderColor
: D.ColorSelector.insideBorderColor
}
D.BoxInsetShadow {
visible: !itemView.isCurrent
D.OutsideBoxBorder {
property D.Palette outsideBorderColor: D.Palette {
normal: Qt.rgba(0, 0, 0, 0.05)
normalDark: Qt.rgba(0, 0, 0, 0.4)
}
property D.Palette checkedOutsideBorderColor: D.Palette {
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

The border palette values are defined inline inside the border components, which duplicates styling data and creates extra Palette objects per delegate instance. Consider promoting these palettes to itemView (alongside backgroundColor / checkedBackgroundColor) or extracting a small shared delegate-background component so the Rectangle and borders bind to one source of truth and stay consistent across OSD panels.

Copilot uses AI. Check for mistakes.
Comment on lines +170 to +189
D.InsideBoxBorder {
property D.Palette insideBorderColor: D.Palette {
normal: Qt.rgba(1, 1, 1, 0.1)
normalDark: Qt.rgba(1, 1, 1, 0.05)
}
property D.Palette checkedInsideBorderColor: D.Palette {
normal: Qt.rgba(1, 1, 1, 0.15)
normalDark: Qt.rgba(1, 1, 1, 0.08)
}
radius: backgroundRect.radius
anchors.fill: parent
shadowOffsetX: 0
shadowOffsetY: 1
shadowColor: itemView.D.ColorSelector.dropShadowColor
shadowBlur: 1
cornerRadius: backgroundRect.radius
spread: 0
hollow: true
color: itemView.isCurrent ? D.ColorSelector.checkedInsideBorderColor
: D.ColorSelector.insideBorderColor
}
D.BoxInsetShadow {
visible: !itemView.isCurrent
D.OutsideBoxBorder {
property D.Palette outsideBorderColor: D.Palette {
normal: Qt.rgba(0, 0, 0, 0.05)
normalDark: Qt.rgba(0, 0, 0, 0.4)
}
property D.Palette checkedOutsideBorderColor: D.Palette {
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

The inside/outside border palettes are declared inside the border items, which makes the delegate styling harder to maintain and repeats Palette object creation for every row. Prefer defining the border palettes on itemView (or using a shared delegate-background component) and binding the border color to itemView.D.ColorSelector.* so all state colors live in one place.

Copilot uses AI. Check for mistakes.
1. Replaced D.BoxShadow and D.BoxInsetShadow components with
D.InsideBoxBorder and D.OutsideBoxBorder in display mode and window
effect panels
2. Added new color palette properties for inside and outside borders
with checked and normal states
3. Adjusted background color darkness in dark mode from 0.6 to 0.5 for
better contrast
4. Added D.OutsideBoxBorder component to main OSD window
5. Removed obsolete dropShadowColor and innerShadowColor palette
properties

This change transitions from shadow-based visual effects to border-based
effects for clearer definition of UI elements while maintaining visual
hierarchy. Border effects provide better visibility across different
themes and improve rendering performance.

Log: Updated OSD notification visual style with borders replacing
shadows for better clarity and theme consistency

Influence:
1. Test OSD notifications in both light and dark modes to verify border
visibility
2. Verify selected and unselected states show proper border colors
3. Check display mode switching and ensure visual consistency
4. Test window effects and notification popups for proper border
rendering
5. Verify that the changes don't affect touch interactions or
responsiveness
6. Confirm that the visual hierarchy remains clear with the new border
effects

PMS: BUG-311255
@deepin-ci-robot
Copy link

deepin pr auto review

这段代码的 diff 展示了两个 QML 文件(displaymode/package/main.qmlwindoweffect/package/main.qml)中 UI 组件样式的重构。主要的改动是将基于阴影的视觉反馈(D.BoxShadowD.BoxInsetShadow)替换为基于边框的视觉反馈(D.InsideBoxBorderD.OutsideBoxBorder)。

以下是对这段 diff 的详细审查意见,分为语法逻辑、代码质量、代码性能和代码安全四个方面:

1. 语法逻辑

  • 变更逻辑清晰:代码将原本用于模拟立体感的阴影效果(外部阴影和内部阴影)替换为了明确的边框效果(内部边框和外部边框)。从视觉逻辑上看,这是一种从"拟物化"或"阴影深度"向"扁平化"或"线条分割"风格的转变。
  • 属性绑定正确
    • 新增的 D.InsideBoxBorderD.OutsideBoxBorder 正确使用了 anchors.fill: parentradius: backgroundRect.radius,确保了边框与背景矩形的大小和圆角一致。
    • 颜色属性(color)正确地通过三元运算符 itemView.isCurrent ? ... : ... 绑定到了对应的 Palette 属性上,逻辑与背景色的切换保持一致。
  • 作用域问题:在 D.InsideBoxBorderD.OutsideBoxBorder 内部定义了 property D.Palette ...。虽然在 QML 中这是合法的(作为该组件的子属性),但需要注意 D.ColorSelector 的作用域。代码中使用了 D.ColorSelector.checkedInsideBorderColor,这意味着 D.ColorSelector 必须能够访问到这些新定义的属性。如果 D.ColorSelector 是一个单例或父级对象,且没有显式地将这些动态定义的属性附加到它上面,可能会导致属性未定义的错误。通常这种写法在自定义组件内部是可行的,但需确认 D.ColorSelector 的具体实现。

2. 代码质量

  • 代码可维护性提升
    • 移除冗余属性:删除了 dropShadowColorinnerShadowColor 这两个不再使用的属性定义,减少了代码冗余,符合"删除死代码"的最佳实践。
    • 语义化改进:使用 InsideBoxBorderOutsideBoxBorder 比使用 BoxShadow 配合 hollow: trueBoxInsetShadow 在语义上更直观,开发者更容易理解代码意图是绘制边框而非投射阴影。
  • 一致性:两个文件 (displaymodewindoweffect) 的修改完全一致,保证了 UI 风格在不同模块间的统一性,这是很好的代码规范。
  • 硬编码颜色值:所有的颜色值(如 Qt.rgba(1, 1, 1, 0.1))都是硬编码的。虽然使用了 D.Palette 进行了封装,但建议确认这些颜色值是否符合项目的设计规范文档,或者是否应该从全局的主题配置中读取,以便于未来统一调整主题。

3. 代码性能

  • 渲染性能潜在优化
    • 阴影 vs 边框:通常情况下,绘制简单的边框(尤其是纯色边框)比绘制模糊阴影(需要高斯模糊计算)的开销要小。原来的 D.BoxShadowD.BoxInsetShadow 即使 shadowBlur 只有 1,也可能涉及较复杂的着色器计算或图层合成。替换为边框后,GPU 的渲染压力可能会减轻,尤其是在列表项频繁滚动或状态切换时。
    • 属性绑定:新代码中 color 属性依赖于 itemView.isCurrent 的状态。这种绑定是必要的,但需确保 isCurrent 的变化不会过于频繁导致过度重绘。
  • 对象实例化:原来的代码中,D.BoxShadowD.BoxInsetShadow 都有 visible: !itemView.isCurrent。这意味着虽然它们在非选中状态下不可见,但对象仍然被实例化了。新代码中的 D.InsideBoxBorderD.OutsideBoxBorder 没有设置 visible 属性绑定,这意味着它们在选中和非选中状态下都会被渲染。虽然边框渲染开销小,但如果能通过 Loader 或动态创建来进一步减少非必要状态下的对象实例化,理论上性能会更好(不过考虑到边框开销极低,这种优化可能收益不大,反而增加代码复杂度)。

4. 代码安全

  • 无明显安全风险:这段代码主要涉及 UI 渲染和样式定义,不涉及用户输入处理、文件访问、网络请求或权限控制,因此不存在注入攻击、越权访问等常规安全风险。
  • 类型安全:代码中大量使用了 D.Palette 类型,这是 DTK (Deepin Tool Kit) 框架中的类型。确保所有赋值给 color 属性的对象都是有效的 D.Palette 实例,否则可能导致运行时错误或渲染异常。目前的代码结构看起来是类型安全的。

改进建议

  1. 检查 D.ColorSelector 的属性访问
    建议确认 D.ColorSelector.checkedInsideBorderColor 这种写法是否能正确获取到 property D.Palette checkedInsideBorderColor: D.Palette { ... } 中定义的值。如果 D.ColorSelector 是一个外部单例,可能需要将这些属性提升到与 checkedBackgroundColor 同级的作用域,或者确保 D.ColorSelector 能够动态聚合这些属性。

  2. 代码复用
    由于 displaymode/package/main.qmlwindoweffect/package/main.qml 中的这段代码(backgroundRect 及其子元素)完全一致,建议考虑将这部分抽取成一个独立的可复用 QML 组件(例如 SelectableBackground.qml)。这样可以避免重复代码,如果以后需要修改选中态的样式,只需修改一处即可。

  3. 属性分组
    D.InsideBoxBorderD.OutsideBoxBorder 内部定义多个 D.Palette 属性虽然逻辑上内聚,但使得代码层级变深。可以考虑将这些 Palette 定义上移到 itemView 的属性组中(类似于原来的 checkedBackgroundColor),然后在边框组件中直接引用。这样结构会更扁平。

    修改示例(建议):

    // 在 itemView 的属性定义区域
    property D.Palette checkedBackgroundColor: D.Palette { ... }
    
    // 新增边框颜色属性
    property D.Palette insideBorderColor: D.Palette { ... }
    property D.Palette checkedInsideBorderColor: D.Palette { ... }
    property D.Palette outsideBorderColor: D.Palette { ... }
    property D.Palette checkedOutsideBorderColor: D.Palette { ... }
    
    // 在 backgroundRect 内部
    D.InsideBoxBorder {
        radius: backgroundRect.radius
        anchors.fill: parent
        // 直接引用 itemView 的属性,而不是在内部定义
        color: itemView.isCurrent ? itemView.checkedInsideBorderColor 
                                  : itemView.insideBorderColor
    }
    // OutsideBoxBorder 同理
  4. 透明度一致性
    注意检查新定义的边框透明度(Alpha 值)在不同背景下是否依然清晰可见。例如 outsideBorderColornormalDark0.4,而 normal0.05,差异较大。需确保在深色和浅色模式下,边框的视觉权重是平衡的。

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.

4 participants