Repository navigation
Conversation
1. Root cause: commit 78deba7 introduced deleteLater() + nullptr in hideFindWidget(), destroying FindWidget on tab switch; restoreSavedViewState() lacked findWidgetVisible field so search box never reappeared 2. Fix: add findWidgetVisible to SheetOperation, save it in saveCurrentViewState(), restore via handlePrepareSearch() in restoreSavedViewState(); change hideFindWidget() to hide() only, removing deleteLater() and nullptr assignment 3. Impact: FindWidget survives tab switches preserving search text; stopSearch() still called before hide prevents search cross-contamination regression (bug 376317) Log: fix search box disappearing after switching tabs in multi-tab mode Influence: 1. Test search box visibility after switching between tabs 2. Verify search text is preserved after tab switch 3. Verify no search cross-contamination between tabs fix: 修复切换标签页后搜索框不显示的问题 1. 根因:commit 78deba7 在 hideFindWidget() 中引入 deleteLater() 和 nullptr 赋值,切换标签页时销毁了 FindWidget; restoreSavedViewState() 缺少 findWidgetVisible 字段,切回时 无法恢复搜索框显示 2. 方案:SheetOperation 添加 findWidgetVisible 字段, saveCurrentViewState() 保存搜索框可见性,restoreSavedViewState() 通过 handlePrepareSearch() 恢复;hideFindWidget() 改为仅 hide() 移除 deleteLater() 和 nullptr 赋值 3. 影响:FindWidget 在标签页切换后存活并保留搜索文本; stopSearch() 仍在 hide 前调用,防止搜索串档回归(bug 376317) Log: 修复多标签页模式下切换标签页后搜索框消失的问题 Influence: 1. 测试切换标签页后搜索框可见性恢复 2. 验证切换标签页后搜索文本保留 3. 验证标签页间无搜索串档回归 PMS: BUG-379133
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: pengfeixx 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 |
Reviewer's GuideThe fix keeps FindWidget alive across tab switches, records its visibility in each sheet’s saved view state before hiding it, and restores the search UI when returning to that tab while preserving the existing stop-search isolation behavior. Sequence diagram for restoring find widget visibility on tab switchsequenceDiagram
participant CentralDocPage
participant PreviousSheet
participant DocSheet
participant SheetBrowser
participant FindWidget
participant CurrentSheet
CentralDocPage->>PreviousSheet: saveCurrentViewState()
PreviousSheet->>SheetBrowser: isFindWidgetVisible()
SheetBrowser->>FindWidget: isVisible()
FindWidget-->>SheetBrowser: visibility
SheetBrowser-->>PreviousSheet: findWidgetVisible
PreviousSheet->>PreviousSheet: closeFindWidget()
PreviousSheet->>SheetBrowser: hideFindWidget()
SheetBrowser->>FindWidget: hide()
CentralDocPage->>CurrentSheet: restoreSavedViewState()
CurrentSheet->>SheetBrowser: handlePrepareSearch()
SheetBrowser-->>CurrentSheet: FindWidget remains visible
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ❌评价: 存在逻辑缺陷 ❌ 不通过 潜在问题: 建议: ['将 handlePrepareSearch() 中的 connect() 移入 if (m_findWidget == nullptr) 块内,或使用 Qt::UniqueConnection 避免重复连接'] 2. 代码质量 ✅评价: 代码结构清晰,注释完整 ✅ 通过 潜在问题: 建议: [] 3. 代码性能 ✅评价: 性能良好,资源使用合理 ✅ 通过 潜在问题: 建议: ['将 connect() 移入 if (m_findWidget == nullptr) 块内或使用 Qt::UniqueConnection,避免连接累积'] 4. 代码安全 🔒评价: 存在0个安全漏洞 ✅ 通过
安全漏洞详情: 建议: [] 💡 改进建议代码示例// 修复方案:将 connect() 移入 if (m_findWidget == nullptr) 块内
// 文件:reader/browser/SheetBrowser.cpp
void SheetBrowser::handlePrepareSearch()
{
qCDebug(appLog) << "Preparing search for file type:" << m_sheet->fileType();
if (!Dr::supportsSearch(m_sheet->fileType())) {
qCDebug(appLog) << "Search not supported for current file type";
return;
}
if (m_findWidget == nullptr) {
m_findWidget = new FindWidget(this->window());
int windowY = this->mapTo(this->window(), QPoint(0, 0)).y();
m_findWidget->setYOff(windowY);
m_findWidget->setDocSheet(m_sheet);
qCDebug(appLog) << "Created new FindWidget with Y offset:" << windowY;
#ifdef DTKWIDGET_CLASS_DSizeMode
// 将 connect() 移入此块内,确保仅在创建控件时连接一次
connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::sizeModeChanged, this, [=](DGuiApplicationHelper::SizeMode sizeMode) {
if(m_findWidget && m_findWidget->isVisible()){
m_findWidget->updatePosition();
}
});
#endif
}
m_findWidget->updatePosition();
m_findWidget->setSearchEditFocus();
qCDebug(appLog) << "FindWidget positioned and focused";
}本报告由 AI 代码审查工具自动生成 |
fix: restore find widget visibility on tab switch
nullptr in hideFindWidget(), destroying FindWidget on tab
switch; restoreSavedViewState() lacked findWidgetVisible
field so search box never reappeared
saveCurrentViewState(), restore via handlePrepareSearch() in
restoreSavedViewState(); change hideFindWidget() to hide()
only, removing deleteLater() and nullptr assignment
text; stopSearch() still called before hide prevents search
cross-contamination regression (bug 376317)
Log: fix search box disappearing after switching tabs in multi-tab mode
Influence:
fix: 修复切换标签页后搜索框不显示的问题
和 nullptr 赋值,切换标签页时销毁了 FindWidget;
restoreSavedViewState() 缺少 findWidgetVisible 字段,切回时
无法恢复搜索框显示
saveCurrentViewState() 保存搜索框可见性,restoreSavedViewState()
通过 handlePrepareSearch() 恢复;hideFindWidget() 改为仅 hide()
移除 deleteLater() 和 nullptr 赋值
stopSearch() 仍在 hide 前调用,防止搜索串档回归(bug 376317)
Log: 修复多标签页模式下切换标签页后搜索框消失的问题
Influence:
PMS: BUG-379133
Summary by Sourcery
Preserve find-widget state across document tab switches without allowing searches to leak between tabs.
Bug Fixes:
Enhancements: