Skip to content

Conversation

@wjyrich
Copy link
Contributor

@wjyrich wjyrich commented Aug 7, 2025

  1. Restructured tooltip timer and positioning logic outside the Image component
  2. Replaced TapHandler with MouseArea for better click handling consistency
  3. Fixed tooltip positioning by using toggleworkspace coordinates instead of Applet.rootObject
  4. Maintained hover behavior but with cleaner separation of concerns

The changes improve the reliability of the workspace switching functionality and tooltip display in the dock's multitask view. The new MouseArea provides more consistent click handling compared to the previous TapHandler implementation. The tooltip positioning is now more accurate as it uses the correct coordinate space.

fix: 修复点击范围保持跟应用一致.

  1. 将工具提示计时器和定位逻辑从Image组件中移出并重构
  2. 用MouseArea替换TapHandler以获得更一致的点击处理
  3. 通过使用toggleworkspace坐标而非Applet.rootObject修复工具提示定位
  4. 保持悬停行为但实现了更清晰的关注点分离

这些改动提高了dock中多任务视图的工作区切换功能和工具提示显示的可靠性。新
的MouseArea相比之前的TapHandler提供了更一致的点击处理。工具提示定位现在
更加准确,因为它使用了正确的坐标空间。

Pms: BUG-323763

Summary by Sourcery

Refactor tooltip display and click handling in the dock's multitask view to improve reliability and accuracy

Bug Fixes:

  • Align click area with the app icon by replacing TapHandler with MouseArea
  • Fix tooltip positioning to use toggleworkspace coordinates instead of Applet.rootObject

Enhancements:

  • Extract tooltip timer and positioning logic out of the Image component
  • Maintain hover-triggered tooltip behavior with clearer separation of concerns

1. Restructured tooltip timer and positioning logic outside the Image
component
2. Replaced TapHandler with MouseArea for better click handling
consistency
3. Fixed tooltip positioning by using toggleworkspace coordinates
instead of Applet.rootObject
4. Maintained hover behavior but with cleaner separation of concerns

The changes improve the reliability of the workspace switching
functionality and tooltip display in the dock's multitask view. The
new MouseArea provides more consistent click handling compared to the
previous TapHandler implementation. The tooltip positioning is now more
accurate as it uses the correct coordinate space.

fix: 修复点击范围保持跟应用一致.

1. 将工具提示计时器和定位逻辑从Image组件中移出并重构
2. 用MouseArea替换TapHandler以获得更一致的点击处理
3. 通过使用toggleworkspace坐标而非Applet.rootObject修复工具提示定位
4. 保持悬停行为但实现了更清晰的关注点分离

这些改动提高了dock中多任务视图的工作区切换功能和工具提示显示的可靠性。新
的MouseArea相比之前的TapHandler提供了更一致的点击处理。工具提示定位现在
更加准确,因为它使用了正确的坐标空间。

Pms: BUG-323763
@deepin-ci-robot
Copy link

deepin pr auto review

代码审查意见:

  1. 代码结构

    • TimerMouseArea组件中,onTriggeredonClicked函数的代码块应该保持一致的缩进,以提高代码的可读性。
    • HoverHandler组件的onHoveredChanged函数中的代码块缩进不一致,建议统一缩进格式。
  2. 变量命名

    • var point变量名不够具体,建议使用更具描述性的变量名,如tooltipPosition
  3. 逻辑改进

    • toolTipShowTimer的启动和停止逻辑可以封装成一个函数,以减少代码重复。
    • onHoveredChanged函数中,toolTip.close()应该在toolTipShowTimer.stop()之后调用,以确保工具提示在停止计时器后关闭。
  4. 性能优化

    • Timer组件的interval设置为50毫秒,如果这个时间间隔对于工具提示的显示不是必须的,可以考虑适当增加,以减少不必要的计算和资源消耗。
  5. 代码安全

    • 没有发现明显的安全漏洞,但是建议确保Applet.openWorkspace()toolTip.close()方法调用不会导致应用程序崩溃或异常行为。
  6. 注释

    • 建议为TimerMouseAreaHoverHandler组件添加注释,说明它们的作用和用途,以提高代码的可维护性。

综合以上意见,代码可以进一步优化,以提高代码质量、可读性和性能。

@sourcery-ai
Copy link

sourcery-ai bot commented Aug 7, 2025

Reviewer's Guide

Restructured tooltip and input handling in the dock’s multitask view by moving timer logic out of the Image component, replacing TapHandler with MouseArea for consistent clicks, using toggleworkspace coordinates for tooltip positioning, and extracting hover behavior for cleaner separation of concerns.

Sequence diagram for click and tooltip behavior with MouseArea

sequenceDiagram
    participant User as actor User
    participant MouseArea
    participant Applet
    participant toolTip
    User->>MouseArea: Click (Left Button)
    MouseArea->>Applet: openWorkspace()
    MouseArea->>toolTip: close()
Loading

Sequence diagram for hover and tooltip display

sequenceDiagram
    participant User as actor User
    participant HoverHandler
    participant Timer
    participant toolTip
    User->>HoverHandler: Hover in
    HoverHandler->>Timer: start()
    Timer->>toolTip: open() (after interval)
    User->>HoverHandler: Hover out
    HoverHandler->>Timer: stop()
    HoverHandler->>toolTip: close()
Loading

Class diagram for updated input and tooltip handling in multitaskview.qml

classDiagram
    class AppletItem {
    }
    class MouseArea {
        +onClicked(mouse)
    }
    class Timer {
        +onTriggered()
    }
    class HoverHandler {
        +onHoveredChanged
    }
    class toolTip {
        +open()
        +close()
        DockPanelPositioner.bounding
    }
    AppletItem o-- MouseArea : contains
    AppletItem o-- Timer : contains
    AppletItem o-- HoverHandler : contains
    AppletItem o-- toolTip : uses
    MouseArea --> toolTip : closes on click
    Timer --> toolTip : opens on trigger
    HoverHandler --> Timer : starts/stops
    HoverHandler --> toolTip : closes on hover out
Loading

File-Level Changes

Change Details Files
Refactored tooltip timer and positioning logic
  • Moved Timer component outside the Image block
  • Updated mapToItem call to use toggleworkspace for accurate coordinates
panels/dock/multitaskview/package/multitaskview.qml
Replaced TapHandler with MouseArea for click handling
  • Removed TapHandler element
  • Added MouseArea with onClicked checking for left mouse button
panels/dock/multitaskview/package/multitaskview.qml
Separated HoverHandler for cleaner hover behavior
  • Extracted HoverHandler outside the Image component
  • Retained timer start/stop and tooltip close logic
panels/dock/multitaskview/package/multitaskview.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 @wjyrich - 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.

onTapped: {
}

MouseArea {
Copy link
Contributor

Choose a reason for hiding this comment

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

换成MouseArea由什么好处么,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

保持根启动器一致把, 启动器之前用TapHandler 出现过BUG, 这是启动器的注视The TapHandler receives the event after visibleChange, which causes the state to be inverted after synchronization,
// causing the launchpad to be displayed again. However, the MouseArea receives the event before visibleChange.

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743, wjyrich

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

@wjyrich
Copy link
Contributor Author

wjyrich commented Aug 7, 2025

/forcemerge

@deepin-bot
Copy link

deepin-bot bot commented Aug 7, 2025

This pr force merged! (status: behind)

@deepin-bot deepin-bot bot merged commit bd6ae92 into linuxdeepin:master Aug 7, 2025
9 of 10 checks passed
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