Skip to content

fix(reader): close FindWidget before entering slide show mode - #392

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:release/eaglefrom
Resurgamz:agent/pms-bug-bot/ccfae85415a2
Sep 18, 2026
Merged

deepin-bot[bot] merged 1 commit into
linuxdeepin:release/eaglefrom
Resurgamz:agent/pms-bug-bot/ccfae85415a2

Conversation

@Resurgamz

@Resurgamz Resurgamz commented Sep 17, 2026

Copy link
Copy Markdown

Root Cause Analysis

When entering slideshow mode via CentralDocPage::openSlide(), the search box (FindWidget) is not closed. FindWidget is a DFloatingWidget with high z-order; when the window goes fullscreen and triggers a resize event, FindWidget::eventFilter calls updatePosition() which executes show() + raise(), causing the search box to float on top of the slideshow.

Key evidence:

  • reader/uiframe/CentralDocPage.cpp:699-704openSlide() lacks closeFindWidget() call
  • reader/widgets/FindWidget.cpp:50-55updatePosition() calls show() + raise()
  • reader/uiframe/CentralDocPage.cpp:280onTabChanged() already correctly calls closeFindWidget()

Fix

Add docSheet->closeFindWidget(); before creating SlideWidget in openSlide(), consistent with the existing pattern in onTabChanged().

Change Safety Assessment

Code Safety

  • Risk Level: Low
  • Only one line added — calling existing method DocSheet::closeFindWidget(), no new symbols introduced
  • closeFindWidget() is idempotent (no-op when FindWidget doesn't exist); guarded by m_findWidget.isNull() internally
  • Consistent with onTabChanged() pattern at CentralDocPage.cpp:280

Business Impact Scope

Affects the slideshow feature in Document Viewer. When a user opens the search box and then enters slideshow mode (right-click menu or F5), the search box will now be properly hidden. No other features or user scenarios are affected.

Verification Suggestion

  1. Open a document in Document Viewer, press Ctrl+F to show the search box, then press F5 to enter slideshow — verify the search box is no longer visible
  2. Exit slideshow and verify search box functionality still works normally

根因分析

CentralDocPage::openSlide() 进入幻灯片放映模式时,未调用 closeFindWidget() 关闭搜索框。FindWidgetDFloatingWidget,z-order 高于普通 widget;窗口全屏触发 resize 事件后,FindWidget::eventFilter 调用 updatePosition() 执行 show() + raise(),导致搜索框浮在放映画面之上。

关键证据:

  • reader/uiframe/CentralDocPage.cpp:699-704openSlide() 缺少 closeFindWidget() 调用
  • reader/widgets/FindWidget.cpp:50-55updatePosition() 调用 show() + raise()
  • reader/uiframe/CentralDocPage.cpp:280onTabChanged() 已正确调用 closeFindWidget()

修复方案

openSlide() 创建 SlideWidget 之前新增 docSheet->closeFindWidget();,与 onTabChanged() 中的已有模式一致。

改动安全评估

代码安全评估

  • 风险等级:低
  • 仅新增一行已有方法调用 DocSheet::closeFindWidget(),无新增符号
  • closeFindWidget() 是幂等操作(FindWidget 不存在时为空操作),内部有 m_findWidget.isNull() 保护
  • onTabChanged()CentralDocPage.cpp:280)中的已有模式完全一致

业务影响范围

影响文档查看器的幻灯片放映功能。用户打开搜索框后进入幻灯片放映(右键菜单或 F5),搜索框将被正确隐藏。不影响其他功能模块和用户场景。

验证建议

  1. 在文档查看器中打开文档,按 Ctrl+F 显示搜索框,再按 F5 进入幻灯片放映——验证搜索框不再显示
  2. 退出放映后验证搜索框功能正常

Summary by Sourcery

Bug Fixes:

  • Close the document search widget before entering slideshow mode so it cannot remain visible over the presentation.

BUG-374537: 幻灯片放映页面仍显示搜索框

CentralDocPage::openSlide() 进入幻灯片放映模式时未调用
docSheet->closeFindWidget() 关闭搜索框,导致 FindWidget 在
全屏 resize 事件中被 show()+raise() 浮在放映画面之上。

在创建 SlideWidget 之前调用 closeFindWidget(),与 onTabChanged()
中的已有模式一致。

Log: 修复幻灯片放映时搜索框仍显示的问题
Bug: https://pms.uniontech.com/bug-view-374537.html
@sourcery-ai

sourcery-ai Bot commented Sep 17, 2026

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

Reviewer's Guide

Fixes slideshow entry so an open FindWidget is hidden before SlideWidget creation, preventing it from resurfacing above fullscreen slideshow content while preserving existing document and search behavior.

Sequence diagram for closing FindWidget before slideshow mode

sequenceDiagram
    participant User
    participant CentralDocPage
    participant DocSheet
    participant FindWidget
    participant SlideWidget

    User->>CentralDocPage: openSlide()
    CentralDocPage->>DocSheet: closeFindWidget()
    DocSheet->>FindWidget: close()
    CentralDocPage->>SlideWidget: new SlideWidget(getCurSheet())
    Note over FindWidget,SlideWidget: FindWidget remains hidden during slideshow
Loading

File-Level Changes

Change Details Files
Close the document search widget before entering slideshow mode.
  • Invoke the existing idempotent cleanup method after validating the current document and before constructing the slideshow widget.
  • Prevent resize-driven repositioning from making the high-z-order search box visible over the slideshow.
reader/uiframe/CentralDocPage.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

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


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

🤖 AI 代码审查报告

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

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 总体评分 100 分,大于 70 分通过阈值,代码质量符合要求。本次变更为单行 Bug 修复,在进入幻灯片放映模式前关闭搜索框,修复方案合理且与已有代码模式一致。

🔍 详细分析

1. 语法逻辑 ✅

评价: 优秀 ✅ 通过

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

建议: 语法正确,逻辑清晰。新增的 docSheet->closeFindWidget() 调用位于 docSheet 空指针检查之后,调用顺序合理——先关闭搜索框再创建幻灯片组件。与 onTabChanged() 中的已有模式一致。


2. 代码质量 ✅

评价: 优秀 ✅ 通过

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

建议: 代码结构清晰,注释完整。变更最小化(仅1行),方法名 closeFindWidget() 自解释,无需额外注释。与 onTabChanged()(CentralDocPage.cpp:280)中的已有模式完全一致,无重复代码引入。


3. 代码性能 ✅

评价: 优秀 ✅ 通过

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

建议: 性能良好,资源使用合理。closeFindWidget() 是轻量级 UI 操作(关闭浮动窗口),仅在进入幻灯片放映模式时调用一次,无性能影响。


4. 代码安全 🔒

评价: 优秀 ✅ 通过

🔐 发现 0 个安全漏洞

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

建议: 无安全风险。本次变更仅调用已有的 UI 组件关闭方法,不涉及用户输入处理、外部数据交互、文件操作或网络通信,不存在安全攻击面。


💡 改进建议代码示例

// 修复代码已在 PR 中正确实现,无需额外修改
// reader/uiframe/CentralDocPage.cpp - openSlide() 方法
void CentralDocPage::openSlide()
{
    DocSheet *docSheet = getCurSheet();
    if (docSheet && docSheet->opened() && m_slideWidget == nullptr) {
        docSheet->closeFindWidget();  // 新增:关闭搜索框
        m_slideWidget = new SlideWidget(getCurSheet());
    }
}

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

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: max-lvs, Resurgamz

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

@Resurgamz

Copy link
Copy Markdown
Author

/merge

@deepin-bot
deepin-bot Bot merged commit 17d7b5f into linuxdeepin:release/eagle Sep 18, 2026
9 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