Skip to content

Conversation

@yixinshark
Copy link
Contributor

@yixinshark yixinshark commented Sep 23, 2025

only accept left mouse button

Log: as title
Pms: BUG-293895

Summary by Sourcery

Bug Fixes:

  • Restrict tray button to accept only left mouse button clicks when toggling the stash popup

@sourcery-ai
Copy link

sourcery-ai bot commented Sep 23, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

The PR refactors the click handling in ActionShowStashDelegate.qml to use a dedicated MouseArea that only accepts left-button clicks, ensuring the tray button no longer responds to right-clicks.

File-Level Changes

Change Details Files
Limit tray button interaction to left mouse clicks via MouseArea
  • Wrapped existing click logic in a MouseArea
  • Set MouseArea.acceptedButtons to Qt.LeftButton
  • Moved onClicked handler from root to the new MouseArea
  • Ensured toolTip.close() remains in onClicked logic
panels/dock/tray/package/ActionShowStashDelegate.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 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.

@yixinshark yixinshark force-pushed the fix-applicationTrayClick branch from d20db8a to 22fdd4b Compare September 23, 2025 07:31
@yixinshark yixinshark force-pushed the fix-applicationTrayClick branch 8 times, most recently from 19a4bc1 to 474f0df Compare September 24, 2025 06:06
@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

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

…pup window

application tray Button only accepts left-click mouse button to open the popup window
, and left-click or right-click to close the pop-up window

Log: as title
Pms: BUG-293895
@yixinshark yixinshark force-pushed the fix-applicationTrayClick branch from 474f0df to 888ab47 Compare September 24, 2025 07:34
@yixinshark
Copy link
Contributor Author

/forcemerge

@deepin-ci-robot
Copy link

deepin pr auto review

我来对这段代码进行审查,并提出改进意见:

  1. AppletItemBackground.qml 文件改进:

优点:

  • 添加了 MouseArea 来处理鼠标事件,这是一个好的改进
  • 使用 acceptedButtons 明确定义了接受的鼠标按钮类型

改进建议:

  • 建议添加 hoverEnabled 属性来明确控制悬停行为
  • 建议添加 onClicked 或 onPressed 信号处理函数,即使目前不需要处理点击事件,也应该预留这些处理函数
  • 可以考虑添加 cursorShape 属性来改变鼠标悬停时的样式,提升用户体验
  • 建议添加 visual feedback(如点击效果)来增强交互体验
  1. ActionShowStashDelegate.qml 文件改进:

优点:

  • 移除了多余的 HoverHandler,直接使用 onHoveredChanged,简化了代码结构
  • 代码格式更加统一,移除了多余的分号
  • 添加了对 stashedPopup.popupVisible 的检查,避免不必要的操作

改进建议:

  • 建议将工具提示相关的逻辑抽取为单独的函数,提高代码可读性和可维护性
  • 可以考虑添加动画效果来提升用户体验,如淡入淡出效果
  • 建议添加注释说明 toolTipShowTimer 的作用和延迟时间
  • 可以考虑添加对键盘事件的支持,提高可访问性
  1. ActionToggleCollapseDelegate.qml 文件改进:

优点:

  • 简化了 HoverHandler 的使用,直接使用 onHoveredChanged
  • 代码结构更加清晰

改进建议:

  • 建议保留 inputEventsEnabled 的检查,这是一个好的实践
  • 可以考虑添加对键盘事件的处理
  • 建议添加视觉反馈,如悬停时的颜色变化
  • 可以考虑将工具提示相关的逻辑抽取为可复用的组件

通用改进建议:

  1. 代码性能:
  • 可以考虑使用 Binding 元素来优化属性绑定性能
  • 对于频繁更新的属性,可以考虑使用 onXXXChanged 而不是持续绑定
  1. 代码安全:
  • 建议对所有外部输入进行验证
  • 添加错误处理机制,防止潜在的运行时错误
  • 考虑添加边界条件检查
  1. 代码质量:
  • 建议添加更多的注释,特别是复杂的逻辑部分
  • 可以考虑使用更多的常量定义,避免魔法数字
  • 建议统一命名规范和代码风格
  1. 用户体验:
  • 添加适当的动画效果
  • 考虑添加键盘导航支持
  • 确保交互元素的响应性

这些改进建议旨在提高代码的可维护性、性能和用户体验。根据实际需求,可以选择性地实施这些建议。

@deepin-bot
Copy link

deepin-bot bot commented Sep 24, 2025

This pr force merged! (status: blocked)

@deepin-bot deepin-bot bot merged commit 341b1b8 into linuxdeepin:master Sep 24, 2025
7 of 11 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