Skip to content

sync: from linuxdeepin/dtkdeclarative#305

Merged
mhduiy merged 1 commit into
masterfrom
sync-pr-532-nosync
Sep 25, 2025
Merged

sync: from linuxdeepin/dtkdeclarative#305
mhduiy merged 1 commit into
masterfrom
sync-pr-532-nosync

Conversation

@deepin-ci-robot
Copy link
Copy Markdown
Contributor

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

Synchronize source files from linuxdeepin/dtkdeclarative.

Source-pull-request: linuxdeepin/dtkdeclarative#532

Summary by Sourcery

Sync AlertToolTip.qml from upstream: add default vertical positioning and disable opacity animations to avoid transparency issues

Enhancements:

  • Add default y positioning for tooltips with spacing fallback
  • Disable opacity animations in enter and exit transitions due to transparency rendering issues
  • Add TODO comment regarding tooltip transparency workaround

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Sep 25, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR synchronizes AlertToolTip.qml from linuxdeepin/dtkdeclarative, introducing dynamic vertical positioning for tooltips and disabling opacity fade animations due to transparency issues.

Sequence diagram for AlertToolTip enter/exit transitions (opacity animation disabled)

sequenceDiagram
participant "ToolTip"
participant "Transition"
"ToolTip"->>"Transition": Trigger enter
"Transition"->>"ToolTip": Animate y from target.height to target.height + spacing
"ToolTip"->>"Transition": Trigger exit
"Transition"->>"ToolTip": Animate y from target.height + spacing to target.height
Loading

Class diagram for updated AlertToolTip.qml properties and transitions

classDiagram
class ToolTip {
  +Item target
  +int x
  +int y
  +int topPadding
  +int bottomPadding
  +int leftPadding
  +int rightPadding
  +Transition enter
  +Transition exit
}
class Transition {
  +NumberAnimation y
  // Opacity animation temporarily removed
}
ToolTip --> Transition
Loading

Flow diagram for dynamic vertical positioning in AlertToolTip.qml

flowchart TD
A["ToolTip initialized"] --> B["Check if target exists"]
B -->|target exists| C["Set y to target.height + DS.Style.control.spacing"]
B -->|target does not exist| D["Set y to 0"]
Loading

File-Level Changes

Change Details Files
Introduce dynamic vertical placement for tooltips relative to target height and spacing
  • Added ‘y’ property: target ? target.height + DS.Style.control.spacing : 0
  • Updated enter transition y animation to start at control.target.height and end at control.target.height + spacing
  • Updated exit transition y animation to reverse from control.target.height + spacing to control.target.height
qt6/src/qml/AlertToolTip.qml
Disable opacity fade animations pending transparency fix
  • Commented out NumberAnimation for opacity in enter transition with TODO note
  • Commented out NumberAnimation for opacity in exit transition
qt6/src/qml/AlertToolTip.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
Copy Markdown

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

Synchronize source files from linuxdeepin/dtkdeclarative.

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

deepin pr auto review

我对这个git diff进行审查,以下是改进意见:

  1. 代码逻辑问题:
  • y属性的初始化逻辑存在潜在问题:当target为null时,y被设置为0,这可能不是预期的行为。应该考虑在target为null时不显示提示框。
  1. 代码质量问题:
  • 存在被注释掉的动画代码,这表明可能存在问题。注释中提到"Transparency causes tooltips to appear through the window background",这是一个重要的UI问题,应该有更好的解决方案而不是简单地移除动画。
  • 变量命名不一致:在enter和exit动画中使用了control.target,但在y属性初始化时直接使用了target,应该保持一致性。
  1. 代码性能问题:
  • 没有看到明显的性能问题,但建议在target为null时不渲染整个组件,可以使用visible: target !== null来控制显示。
  1. 代码安全问题:
  • 没有明显的安全问题,但建议添加null检查以防止潜在的运行时错误。

改进建议:

ToolTip {
    id: control
    property Item target
    
    // 添加可见性控制
    visible: target !== null
    
    x: 0
    y: target ? target.height + DS.Style.control.spacing : 0
    topPadding: DS.Style.alertToolTip.verticalPadding
    bottomPadding: DS.Style.alertToolTip.verticalPadding
    leftPadding: DS.Style.alertToolTip.horizontalPadding
    rightPadding: DS.Style.alertToolTip.horizontalPadding
    
    contentItem: Text {
        text: control.text
        color: DS.Style.alertToolTip.textColor
        font: DS.Style.alertToolTip.font
    }
    
    background: Rectangle {
        color: DS.Style.alertToolTip.backgroundColor
        radius: DS.Style.alertToolTip.radius
    }
    
    enter: Transition {
        // 考虑使用不透明度动画的替代方案
        NumberAnimation { 
            properties: "y"; 
            from: target ? target.height : 0; 
            to: target ? target.height + DS.Style.control.spacing : 0; 
            duration: 200 
        }
    }
    
    exit: Transition {
        NumberAnimation { 
            properties: "y"; 
            from: target ? target.height + DS.Style.control.spacing : 0; 
            to: target ? target.height : 0; 
            duration: 200 
        }
    }
}

这些改进包括:

  1. 添加了visible属性控制,确保target为null时不显示提示框
  2. 统一使用target变量,避免使用control.target
  3. 移除了可能导致UI问题的透明度动画
  4. 为动画添加了target的null检查
  5. 保持了代码的一致性和可读性

对于透明度动画的问题,建议考虑以下替代方案:

  1. 使用缩放动画代替透明度动画
  2. 使用更复杂的背景遮罩来解决穿透问题
  3. 考虑使用其他动画效果,如淡入淡出但配合背景色变化

@mhduiy mhduiy merged commit d0649a9 into master Sep 25, 2025
12 of 16 checks passed
@mhduiy mhduiy deleted the sync-pr-532-nosync branch September 25, 2025 08:13
@deepin-ci-robot
Copy link
Copy Markdown
Contributor Author

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: deepin-ci-robot, 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

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.

2 participants