Skip to content

fix: adjust AlertToolTip position and animations#532

Merged
mhduiy merged 1 commit into
linuxdeepin:masterfrom
mhduiy:tooltip
Sep 25, 2025
Merged

fix: adjust AlertToolTip position and animations#532
mhduiy merged 1 commit into
linuxdeepin:masterfrom
mhduiy:tooltip

Conversation

@mhduiy

@mhduiy mhduiy commented Sep 25, 2025

Copy link
Copy Markdown
Contributor
  1. Added y-position calculation to position tooltip below target element with proper spacing
  2. Removed opacity animations temporarily due to transparency causing tooltips to appear through window background
  3. Maintained vertical slide animations for enter/exit transitions
  4. The opacity animations are commented with TODO for future fix when transparency issue is resolved

fix: 调整 AlertToolTip 位置和动画效果

  1. 添加 y 位置计算,使工具提示在目标元素下方以适当间距定位
  2. 暂时移除透明度动画,因为透明度会导致工具提示透过窗口背景显示
  3. 保留垂直滑动动画用于进入/退出过渡
  4. 透明度动画已添加 TODO 注释,待透明度问题解决后修复

pms: BUG-334771

Summary by Sourcery

Adjust the AlertToolTip component to position below its target with correct spacing, temporarily remove opacity transitions to avoid transparency issues, and retain vertical slide animations for enter/exit transitions.

Enhancements:

  • Calculate the y-position of AlertToolTip to position it below the target element with DS.Style.control.spacing
  • Comment out opacity animations due to transparency causing tooltips to render through the window background
  • Maintain vertical slide NumberAnimation for enter and exit transitions

deepin-ci-robot added a commit to linuxdeepin/dtk6declarative that referenced this pull request Sep 25, 2025
Synchronize source files from linuxdeepin/dtkdeclarative.

Source-pull-request: linuxdeepin/dtkdeclarative#532
@sourcery-ai

sourcery-ai Bot commented Sep 25, 2025

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Recalculates the AlertToolTip’s vertical offset below its target, temporarily removes opacity fades (with TODOs) to avoid background transparency issues, and keeps the slide transitions active.

File-Level Changes

Change Details Files
Add dynamic y-positioning based on target element
  • Bind y to target.height + DS.Style.control.spacing with fallback to 0
qt6/src/qml/AlertToolTip.qml
Temporarily disable opacity animations with TODO notes
  • Comment out opacity NumberAnimation in enter transition
  • Comment out opacity NumberAnimation in exit transition
  • Insert TODO comment for future opacity re-enablement
qt6/src/qml/AlertToolTip.qml
Retain vertical slide animations for enter/exit
  • Keep NumberAnimation on y (from target.height to target.height + spacing) for enter
  • Keep NumberAnimation on y (from target.height + spacing to target.height) for exit
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

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

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 requested a review from Copilot September 25, 2025 08:07

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request fixes positioning and animation issues in the AlertToolTip component. The changes ensure the tooltip appears below its target element and temporarily removes opacity animations to prevent transparency rendering issues.

  • Added y-position calculation to position tooltip below target element with proper spacing
  • Temporarily removed opacity animations due to transparency causing tooltips to render through window background
  • Maintained vertical slide animations for smooth enter/exit transitions

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread qt6/src/qml/AlertToolTip.qml Outdated
@github-actions

github-actions Bot commented Sep 25, 2025

Copy link
Copy Markdown
Contributor

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

deepin-ci-robot added a commit to linuxdeepin/dtk6declarative that referenced this pull request Sep 25, 2025
Synchronize source files from linuxdeepin/dtkdeclarative.

Source-pull-request: linuxdeepin/dtkdeclarative#532
1. Added y-position calculation to position tooltip below target element
with proper spacing
2. Removed opacity animations temporarily due to transparency causing
tooltips to appear through window background
3. Maintained vertical slide animations for enter/exit transitions
4. The opacity animations are commented with TODO for future fix when
transparency issue is resolved

fix: 调整 AlertToolTip 位置和动画效果

1. 添加 y 位置计算,使工具提示在目标元素下方以适当间距定位
2. 暂时移除透明度动画,因为透明度会导致工具提示透过窗口背景显示
3. 保留垂直滑动动画用于进入/退出过渡
4. 透明度动画已添加 TODO 注释,待透明度问题解决后修复

pms: BUG-334771
deepin-ci-robot added a commit to linuxdeepin/dtk6declarative that referenced this pull request Sep 25, 2025
Synchronize source files from linuxdeepin/dtkdeclarative.

Source-pull-request: linuxdeepin/dtkdeclarative#532
@deepin-ci-robot

Copy link
Copy Markdown
Contributor

deepin pr auto review

我对这段代码进行审查,以下是改进意见:

语法逻辑

  1. 代码整体结构清晰,使用了Qt Quick的ToolTip组件作为基础。
  2. 添加了y坐标的绑定逻辑,这是合理的改进,确保了提示框能正确定位在目标元素下方。
  3. 注释掉的透明度动画需要谨慎处理,因为这是一个TODO项,需要后续解决。

代码质量

  1. 建议为target属性添加null检查,虽然y坐标已经做了检查,但在其他地方使用target时也应该注意。
  2. 代码中的DS.Style引用表明使用了自定义样式系统,这是良好的实践,但确保样式常量有适当的文档说明。
  3. exit transition中的动画缺少duration属性,这可能导致退出动画速度不一致。

代码性能

  1. y坐标的绑定是合理的,但要注意target的变化可能会触发重新计算。
  2. 动画性能良好,使用了NumberAnimation,这是Qt Quick中高效的动画类型。

代码安全

  1. 需要确保target属性始终被正确设置,否则可能导致布局问题。
  2. 在使用target.height时,应该确保target已经完成布局,否则可能得到不正确的值。

改进建议

  1. 为exit transition添加duration属性,与enter transition保持一致:
exit: Transition {
    // NumberAnimation { properties: "opacity"; from: 1.0; to: 0.0 }
    NumberAnimation { properties: "y"; from: control.target.height + DS.Style.control.spacing ; to: control.target.height; duration: 200 }
}
  1. 考虑添加更多的错误处理,例如当target为null时的回退方案:
y: target ? target.height + DS.Style.control.spacing : 0
visible: target !== null
  1. 对于TODO项,建议添加更详细的注释,说明透明度动画导致的具体问题以及解决方案:
// TODO: Transparency causes tooltips to appear through the window background
// Consider adding a semi-transparent background or alternative visual effect
// to maintain visual hierarchy while fixing the transparency issue
  1. 建议添加内容大小的限制,防止提示框过大影响用户体验:
width: Math.min(contentWidth, 300) // 或其他合适的最大宽度
  1. 考虑添加鼠标交互处理,例如点击外部区域关闭提示框:
MouseArea {
    anchors.fill: parent
    onClicked: control.close()
}

这些改进将有助于提高代码的健壮性、可维护性和用户体验。

@deepin-ci-robot

Copy link
Copy Markdown
Contributor

[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

@mhduiy mhduiy merged commit 5ed035e into linuxdeepin:master Sep 25, 2025
18 of 21 checks passed
mhduiy pushed a commit to linuxdeepin/dtk6declarative that referenced this pull request Sep 25, 2025
Synchronize source files from linuxdeepin/dtkdeclarative.

Source-pull-request: linuxdeepin/dtkdeclarative#532
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