Skip to content

Conversation

@deepin-ci-robot
Copy link
Contributor

@deepin-ci-robot deepin-ci-robot commented Sep 30, 2025

Synchronize source files from linuxdeepin/dtkdeclarative.

Source-pull-request: linuxdeepin/dtkdeclarative#534

Summary by Sourcery

Sync source files from linuxdeepin/dtkdeclarative, introducing a connector arrow shadow in alert tooltips and refining style palette values.

New Features:

  • Add BoxShadow connector arrow in AlertToolTip.qml for drop-shadowed tooltip pointers.

Enhancements:

  • Increase border opacity in FlowStyle.qml from 0.05 to 0.1 for both normal and dark modes.
  • Adjust connectorBackground normalDark color in FlowStyle.qml to a solid 51/255 gray.

Synchronize source files from linuxdeepin/dtkdeclarative.

Source-pull-request: linuxdeepin/dtkdeclarative#534
@deepin-ci-robot
Copy link
Contributor Author

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: deepin-ci-robot

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 Sep 30, 2025

Reviewer's Guide

This PR syncs QML sources from upstream, enhancing the AlertToolTip by adding a shadowed connector and updating color palettes in FlowStyle to improve border and background visibility.

Entity relationship diagram for updated palette properties in FlowStyle.qml

erDiagram
    FLOWSTYLE {
        real focusBorderPaddings
        D.Palette border
        D.Palette connecterBackground
        D.Palette dropShadow
    }
    D.PALETTE {
        normal
        normalDark
    }
    FLOWSTYLE ||--o| D.PALETTE : border
    FLOWSTYLE ||--o| D.PALETTE : connecterBackground
    FLOWSTYLE ||--o| D.PALETTE : dropShadow
Loading

Class diagram for updated AlertToolTip.qml structure

classDiagram
    class ToolTip {
    }
    class BoxShadow {
        +D.Palette dropShadowColor
        +D.Palette backgroundColor
        +D.Palette borderColor
        +y
        +width
        +height
        +shadowBlur
        +shadowOffsetY
        +shadowColor
        +cornerRadius
    }
    class Rectangle {
        +color
        +border.color
        +border.width
    }
    ToolTip <|-- BoxShadow
    BoxShadow <|-- Rectangle
Loading

Class diagram for updated FlowStyle.qml palette properties

classDiagram
    class FlowStyle {
        +D.Palette border
        +D.Palette connecterBackground
        +D.Palette dropShadow
    }
    class D.Palette {
        +normal
        +normalDark
    }
    FlowStyle --> D.Palette
Loading

File-Level Changes

Change Details Files
Introduce a shadowed connector arrow to the tooltip
  • Add BoxShadow element with dropShadowColor, backgroundColor, borderColor properties
  • Position and size the connector based on control margins and style metrics
  • Nest a Rectangle for background fill and border strokes
qt6/src/qml/AlertToolTip.qml
Refine palette opacity and dark-mode color values
  • Increase border palette opacity from 0.05 to 0.1 for both normal and dark variants
  • Change connector background normalDark from semi-transparent black to solid 51/255 gray
qt6/src/qml/FlowStyle.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

@deepin-ci-robot
Copy link
Contributor Author

deepin pr auto review

根据提供的代码差异,我来对这段代码进行审查,并提出改进建议:

  1. 语法逻辑方面:
  • 代码语法基本符合QML规范,没有明显的语法错误
  • 新增的BoxShadow组件及其内部的Rectangle结构合理
  • y坐标计算使用了表达式 - height * (0.75) - control.topMargin - control.topPadding,逻辑清晰
  1. 代码质量方面:
  • 命名规范:变量命名如dropShadowColorbackgroundColor等具有描述性
  • 组件结构:BoxShadow和Rectangle的组合方式合理,职责分明
  • 样式定义:使用了DS.Style统一管理样式,有利于维护
  1. 代码性能方面:
  • 建议将常用的样式值提取为常量,避免重复计算
  • BoxShadow的shadowBlur和shadowOffsetY等属性可以考虑根据设备性能动态调整
  • 对于频繁重绘的场景,可以考虑缓存BoxShadow的渲染结果
  1. 代码安全方面:
  • 样色值使用了Qt.rgba()函数,确保了颜色值的合法性和安全性
  • 样式定义中使用了D.Palette类型,保证了类型安全
  • 建议为所有样式属性添加边界检查,防止无效值

具体改进建议:

  1. 对于FlowStyle.qml中的颜色值修改:
// 修改前
normal: Qt.rgba(0, 0, 0, 0.05)
normalDark: Qt.rgba(0, 0, 0, 0.05)

// 建议修改为
readonly property real defaultBorderOpacity: 0.05
normal: Qt.rgba(0, 0, 0, defaultBorderOpacity)
normalDark: Qt.rgba(0, 0, 0, defaultBorderOpacity)
  1. 对于connecterBackground的颜色值:
// 修改前
normalDark: Qt.rgba(51 / 255.0, 51 / 255.0, 51 / 255.0, 1)

// 建议修改为
readonly property real darkGrayValue: 51 / 255.0
normalDark: Qt.rgba(darkGrayValue, darkGrayValue, darkGrayValue, 1)
  1. 对于AlertToolTip.qml中的BoxShadow组件:
// 建议添加性能优化
BoxShadow {
    id: line
    // ... 其他属性保持不变
    
    // 添加缓存属性
    layer.enabled: true
    layer.effect: OpacityMask {
        maskSource: Rectangle {
            width: line.width
            height: line.height
            radius: line.cornerRadius
        }
    }
}
  1. 建议添加边界检查:
// 在DS.Style中添加
property real minConnectorWidth: 2
property real maxConnectorWidth: 20

// 在使用时添加验证
width: Math.max(Math.min(DS.Style.alertToolTip.connectorWidth, maxConnectorWidth), minConnectorWidth)
  1. 考虑添加主题适配:
property D.Palette dropShadowColor: DS.Style.isDarkMode ? 
    DS.Style.alertToolTip.connecterdropShadowDark : 
    DS.Style.alertToolTip.connecterdropShadowLight

这些建议旨在提高代码的可维护性、性能和安全性,同时保持代码的清晰和可读性。

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 there - I've reviewed your changes and they look great!


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.

@18202781743 18202781743 merged commit 192fa01 into master Oct 9, 2025
14 of 16 checks passed
@18202781743 18202781743 deleted the sync-pr-534-nosync branch October 9, 2025 05:29
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