Skip to content

fix: make tooltip follow cursor position in launcher - #807

Open
mhduiy wants to merge 1 commit into
linuxdeepin:masterfrom
mhduiy:agent/pms-bug-bot/2b7788416de6
Open

mhduiy wants to merge 1 commit into
linuxdeepin:masterfrom
mhduiy:agent/pms-bug-bot/2b7788416de6

Conversation

@mhduiy

@mhduiy mhduiy commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Root Cause Analysis

All 4 ToolTip usage sites in dde-launchpad relied on Qt's default ToolTip positioning (centered relative to the parent item), without binding ToolTip.toolTip.x/ToolTip.toolTip.y to cursor position. This caused tooltips to appear at a fixed location (above or below the icon) rather than following the mouse cursor. Key evidence: qml/IconItemDelegate.qml:377-379 and qml/windowed/AppListView.qml:220-222 only set text/delay/visible with no position binding; developer note in PMS history confirmed "tooltip position is a fixed value, needs unified handling later."

Fix

Added HoverHandler for cursor tracking in files that lacked one (qml/IconItemDelegate.qml, qml/windowed/IconItemDelegate.qml), and bound ToolTip.toolTip.x/ToolTip.toolTip.y to HoverHandler.point.position in all 4 ToolTip usage sites. Files with existing HoverHandler (qml/windowed/AppListView.qml, qml/windowed/FreeSortListView.qml) reuse the existing itemHoverHandler.

Change Safety Assessment

Code Safety

  • Risk Level: Low
  • All changes are purely additive (new HoverHandler instances and position bindings); no existing code lines modified or deleted
  • Blame history shows the ToolTip text/delay/visible lines were touched by multiple developers for different fixes — this change does not revert any of those fixes
  • No external references to the modified code sections (References=0)

Business Impact Scope

Affects tooltip display position in launcher fullscreen mode (icon grid) and windowed mode (icon grid, app list, free-sort list). Tooltip text content, show/hide logic, and delay timing remain unchanged. Users will see tooltips appear at the cursor position instead of a fixed location above/below the icon.

Verification Suggestion

Test tooltip cursor-following in both fullscreen and windowed launcher modes by hovering over icons with truncated text. Verify tooltips still only appear when text is truncated and that delay timing is unchanged.


根因分析

dde-launchpad 中全部 4 个 ToolTip 使用点均依赖 Qt 默认定位逻辑(相对父项居中),未绑定 ToolTip.toolTip.x/ToolTip.toolTip.y 到光标位置,导致 tooltip 固定出现在图标上方或下方而非跟随鼠标。关键证据:qml/IconItemDelegate.qml:377-379qml/windowed/AppListView.qml:220-222 仅设置 text/delay/visible,无位置绑定;PMS 历史记录中开发者确认"tooltip 为固定值,需要后面统一处理此类型问题"。

修复方案

为缺少 HoverHandler 的文件(qml/IconItemDelegate.qmlqml/windowed/IconItemDelegate.qml)新增 HoverHandler 追踪光标位置,在全部 4 个 ToolTip 使用点绑定 ToolTip.toolTip.x/ToolTip.toolTip.yHoverHandler.point.position。已有 HoverHandler 的文件(qml/windowed/AppListView.qmlqml/windowed/FreeSortListView.qml)复用已有的 itemHoverHandler

改动安全评估

代码安全评估

  • 风险等级: 低风险
  • 所有改动均为纯新增(HoverHandler 实例和位置绑定),未修改或删除任何现有代码行
  • Blame 历史显示 ToolTip text/delay/visible 行曾被多名开发者为不同修复而改动——本次改动不会撤销任何历史修复
  • 无外部代码引用被修改的代码段(References=0)

业务影响范围

影响启动器全屏模式(图标网格)和窗口模式(图标网格、应用列表、自由排序列表)的 tooltip 显示位置。Tooltip 文本内容、显示/隐藏逻辑和延迟时间不变。用户将看到 tooltip 出现在光标位置而非图标上方/下方的固定位置。

验证建议

在全屏和窗口模式下分别测试鼠标 hover 到文字截断图标时 tooltip 是否跟随光标位置显示。验证 tooltip 仍仅在文字截断时显示,延迟时间无变化。

Summary by Sourcery

Bug Fixes:

  • Make launcher tooltips follow the cursor position across fullscreen and windowed views while preserving existing truncation, visibility, and delay behavior.

1. Root cause: all ToolTip attached properties relied on Qt default
   positioning (centered relative to parent item), without binding
   x/y to cursor position, causing tooltips to appear at fixed
   locations instead of following the mouse
2. Fix: add HoverHandler for cursor tracking where absent and bind
   ToolTip.toolTip.x/y to HoverHandler point.position in all 4
   ToolTip usage sites
3. Impact: tooltips now appear at cursor position across fullscreen
   and windowed launcher modes; no change to tooltip text, visibility
   logic, or delay timing

Log: Launcher tooltips now follow the mouse cursor instead of appearing at a fixed position

Influence:
1. Test tooltip appears at cursor position in fullscreen mode
2. Test tooltip appears at cursor position in windowed mode
3. Verify tooltip still only shows when text is truncated
4. Verify tooltip delay and visibility logic unchanged

fix: 启动器 tooltip 跟随光标位置显示

1. 根因:所有 ToolTip 附加属性依赖 Qt 默认定位逻辑(相对父项居中),
   未绑定 x/y 到光标位置,导致 tooltip 固定出现在图标上方/下方而非跟随鼠标
2. 方案:为缺少 HoverHandler 的组件新增 HoverHandler 追踪光标,在全部 4 个
   ToolTip 使用点绑定 ToolTip.toolTip.x/y 到 HoverHandler 的 point.position
3. 影响:全屏和窗口模式下 tooltip 均跟随光标位置显示;不改变 tooltip 文本、
   显示/隐藏逻辑和延迟时间

Log: 启动器 tooltip 现在跟随鼠标光标位置显示,而非固定位置

Influence:
1. 测试全屏模式下 tooltip 跟随光标位置显示
2. 测试窗口模式下 tooltip 跟随光标位置显示
3. 验证 tooltip 仍仅在文字截断时显示
4. 验证 tooltip 延迟和显示/隐藏逻辑无变化

PMS: BUG-276573

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

Sorry @mhduiy, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 5 hours and 30 minutes by commenting @sourcery-ai review. Upgrade to get a review now.

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

@sourcery-ai

sourcery-ai Bot commented Sep 14, 2026

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

Reviewer's Guide

Updates all four launcher tooltip sites to position the tooltip at the current cursor coordinates, adding HoverHandlers for icon delegates and reusing existing handlers in list views while preserving tooltip text, visibility conditions, and delay behavior.

File-Level Changes

Change Details Files
Track pointer coordinates for tooltip placement in icon delegates.
  • Add local HoverHandler instances where cursor tracking was missing.
  • Bind tooltip x/y to the handler’s current pointer position.
qml/IconItemDelegate.qml
qml/windowed/IconItemDelegate.qml
Make list-view tooltips follow the existing hover cursor position.
  • Reuse existing itemHoverHandler instances.
  • Bind tooltip x/y to itemHoverHandler.point.position.
qml/windowed/AppListView.qml
qml/windowed/FreeSortListView.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
Copy Markdown

deepin pr auto review

🤖 AI 代码审查报告

总体评分: 100 分 (通过阈值: 70分)

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 本次提交修改了4个QML文件,通过添加HoverHandler和绑定ToolTip.toolTip.x/y属性实现tooltip跟随光标位置显示。代码变更简洁、正确,符合commit message描述的目的。未发现安全漏洞、语法逻辑错误、代码质量问题或性能问题。OCR审查也未发现任何问题。

🔍 详细分析

1. 语法逻辑 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


2. 代码质量 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


3. 代码性能 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


4. 代码安全 🔒

评价: 优秀 ✅ 通过

🔐 发现 0 个安全漏洞

安全漏洞详情:
✅ 未发现安全漏洞

建议: []


💡 改进建议代码示例

// 暂无代码示例

本报告由 AI 代码审查工具自动生成

@mhduiy

mhduiy commented Sep 17, 2026

Copy link
Copy Markdown
Contributor Author

如果要改,要修改DTK的默认行为,而不是仅仅在这里修改,这个PR暂定

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