fix(reader): close FindWidget before entering slide show mode - #392
deepin-bot[bot] merged 1 commit into
Conversation
BUG-374537: 幻灯片放映页面仍显示搜索框 CentralDocPage::openSlide() 进入幻灯片放映模式时未调用 docSheet->closeFindWidget() 关闭搜索框,导致 FindWidget 在 全屏 resize 事件中被 show()+raise() 浮在放映画面之上。 在创建 SlideWidget 之前调用 closeFindWidget(),与 onTabChanged() 中的已有模式一致。 Log: 修复幻灯片放映时搜索框仍显示的问题 Bug: https://pms.uniontech.com/bug-view-374537.html
Reviewer's guide (collapsed on small PRs)Reviewer's GuideFixes 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 modesequenceDiagram
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
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: 语法正确,逻辑清晰。新增的 docSheet->closeFindWidget() 调用位于 docSheet 空指针检查之后,调用顺序合理——先关闭搜索框再创建幻灯片组件。与 onTabChanged() 中的已有模式一致。 2. 代码质量 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: 代码结构清晰,注释完整。变更最小化(仅1行),方法名 closeFindWidget() 自解释,无需额外注释。与 onTabChanged()(CentralDocPage.cpp:280)中的已有模式完全一致,无重复代码引入。 3. 代码性能 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: 性能良好,资源使用合理。closeFindWidget() 是轻量级 UI 操作(关闭浮动窗口),仅在进入幻灯片放映模式时调用一次,无性能影响。 4. 代码安全 🔒评价: 优秀 ✅ 通过
安全漏洞详情: 建议: 无安全风险。本次变更仅调用已有的 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 代码审查工具自动生成 |
|
[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. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/merge |
Root Cause Analysis
When entering slideshow mode via
CentralDocPage::openSlide(), the search box (FindWidget) is not closed.FindWidgetis aDFloatingWidgetwith high z-order; when the window goes fullscreen and triggers a resize event,FindWidget::eventFiltercallsupdatePosition()which executesshow()+raise(), causing the search box to float on top of the slideshow.Key evidence:
reader/uiframe/CentralDocPage.cpp:699-704—openSlide()lackscloseFindWidget()callreader/widgets/FindWidget.cpp:50-55—updatePosition()callsshow()+raise()reader/uiframe/CentralDocPage.cpp:280—onTabChanged()already correctly callscloseFindWidget()Fix
Add
docSheet->closeFindWidget();before creatingSlideWidgetinopenSlide(), consistent with the existing pattern inonTabChanged().Change Safety Assessment
Code Safety
DocSheet::closeFindWidget(), no new symbols introducedcloseFindWidget()is idempotent (no-op whenFindWidgetdoesn't exist); guarded bym_findWidget.isNull()internallyonTabChanged()pattern atCentralDocPage.cpp:280Business 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
根因分析
CentralDocPage::openSlide()进入幻灯片放映模式时,未调用closeFindWidget()关闭搜索框。FindWidget是DFloatingWidget,z-order 高于普通 widget;窗口全屏触发 resize 事件后,FindWidget::eventFilter调用updatePosition()执行show()+raise(),导致搜索框浮在放映画面之上。关键证据:
reader/uiframe/CentralDocPage.cpp:699-704—openSlide()缺少closeFindWidget()调用reader/widgets/FindWidget.cpp:50-55—updatePosition()调用show()+raise()reader/uiframe/CentralDocPage.cpp:280—onTabChanged()已正确调用closeFindWidget()修复方案
在
openSlide()创建SlideWidget之前新增docSheet->closeFindWidget();,与onTabChanged()中的已有模式一致。改动安全评估
代码安全评估
DocSheet::closeFindWidget(),无新增符号closeFindWidget()是幂等操作(FindWidget不存在时为空操作),内部有m_findWidget.isNull()保护onTabChanged()(CentralDocPage.cpp:280)中的已有模式完全一致业务影响范围
影响文档查看器的幻灯片放映功能。用户打开搜索框后进入幻灯片放映(右键菜单或 F5),搜索框将被正确隐藏。不影响其他功能模块和用户场景。
验证建议
Summary by Sourcery
Bug Fixes: