Skip to content

fix: when hide plugin,setting button sholud be hided.#313

Merged
yixinshark merged 1 commit into
linuxdeepin:masterfrom
wjyrich:fix-bug-310045
May 16, 2025
Merged

fix: when hide plugin,setting button sholud be hided.#313
yixinshark merged 1 commit into
linuxdeepin:masterfrom
wjyrich:fix-bug-310045

Conversation

@wjyrich

@wjyrich wjyrich commented May 16, 2025

Copy link
Copy Markdown
Contributor

as title.

PMS-BUG-310045

Summary by Sourcery

Reset and redraw JumpSettingButton on QEvent::Hide to ensure the settings button hides correctly when its plugin is hidden.

Bug Fixes:

  • Handle QEvent::Hide in JumpSettingButton to clear hover state and trigger update in dde-dock.
  • Handle QEvent::Hide in JumpSettingButton to clear hover state and trigger update in wireless casting plugin.

@github-actions

github-actions Bot commented May 16, 2025

Copy link
Copy Markdown

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

@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

代码审查意见:

  1. 代码重复:

    • 两个文件中的JumpSettingButton::event函数几乎完全相同,除了文件路径和项目名称不同。建议将公共代码提取到一个共享的文件中,以减少代码重复。
  2. 事件处理:

    • JumpSettingButton::event函数中,QEvent::Hide事件的处理逻辑是设置m_hoverfalse并调用update()。但是,QEvent::Hide通常表示窗口或控件被隐藏,而不是鼠标进入或离开事件。如果这个逻辑是正确的,那么应该确保这个事件确实会在JumpSettingButton被隐藏时触发。
  3. 代码风格:

    • 代码缩进和格式应该保持一致,以保持代码的可读性。例如,case QEvent::Hide:default:之间的空行可以去掉,以减少代码行数。
  4. 注释:

    • 考虑为JumpSettingButton::event函数添加注释,说明该函数的用途和每个事件处理分支的作用。
  5. 事件类型检查:

    • case QEvent::Enter:分支中,e->type() == QEvent::Enter可以简化为e->type() == QEvent::Enter,因为e->type()已经是一个QEvent::Type类型的值。
  6. 代码重构:

    • 如果m_hover的状态变化只影响update()的调用,可以考虑将update()的调用移到JumpSettingButton的公共方法中,并在需要的地方调用该方法,而不是在每个事件处理分支中调用update()

综上所述,建议进行以下修改:

  • 将公共代码提取到共享文件中。
  • 确认QEvent::Hide事件是否确实会在JumpSettingButton被隐藏时触发。
  • 调整代码缩进和格式,保持一致性。
  • 添加注释以提高代码可读性。
  • 简化事件类型检查。
  • 考虑重构代码,减少重复的update()调用。

@sourcery-ai

sourcery-ai Bot commented May 16, 2025

Copy link
Copy Markdown

Reviewer's Guide

Introduces a Hide event handler in JumpSettingButton::event to clear hover state and refresh the UI, applied consistently across both the dde-dock and wirelesscasting plugin modules.

File-Level Changes

Change Details Files
Add handling for QEvent::Hide in JumpSettingButton::event to reset hover state
  • Insert case QEvent::Hide branch
  • Set m_hover to false within the new branch
  • Call update() to refresh the button appearance
plugins/dde-dock/common/jumpsettingbutton.cpp
plugins/dde-network-display-ui/plugins/dock-wirelesscasting-plugin/src/widget/jumpsettingbutton.cpp

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

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

@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 @wjyrich - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

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.

@@ -79,6 +79,10 @@ bool JumpSettingButton::event(QEvent* e)
m_hover = e->type() == QEvent::Enter;
update();
break;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion: Duplicate event logic across plugins—factor into shared component

Extract JumpSettingButton into a shared base or common library to avoid divergent implementations and ensure consistent grouping and Show handling.

@wjyrich

wjyrich commented May 16, 2025

Copy link
Copy Markdown
Contributor Author

recheck

@yixinshark yixinshark merged commit aba0ce2 into linuxdeepin:master May 16, 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