Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions reader/browser/SheetBrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2062,6 +2062,16 @@ void SheetBrowser::jumpToPrevSearchResult()
}
}

void SheetBrowser::hideFindWidget()
{
qCDebug(appLog) << "hideFindWidget";
if (!m_findWidget.isNull()) {
m_findWidget->hide();
m_findWidget->deleteLater();
m_findWidget = nullptr;
}
}

void SheetBrowser::handleSearchStart()
{
qCDebug(appLog) << "SheetBrowser::handleSearchStart() - Handling search start";
Expand Down
6 changes: 6 additions & 0 deletions reader/browser/SheetBrowser.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,12 @@ class SheetBrowser : public Dtk::Widget::DGraphicsView
*/
void handlePrepareSearch();

/**
* @brief hideFindWidget
* 隐藏并销毁搜索框,切换标签页时调用,防止搜索串档
*/
void hideFindWidget();

/**
* @brief jumpToNextSearchResult
* 跳到下一个搜索条目中
Expand Down
2 changes: 2 additions & 0 deletions reader/uiframe/CentralDocPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,8 @@ void CentralDocPage::onTabChanged(DocSheet *sheet)
// 离开当前 sheet 前,保存其阅读状态
QPointer<DocSheet> prevSheet = qobject_cast<DocSheet *>(m_stackedLayout->currentWidget());
if (prevSheet && prevSheet != sheet && prevSheet->opened()) {
// 关闭前一个 sheet 的搜索框,防止切换标签后搜索串档
prevSheet->closeFindWidget();
prevSheet->saveCurrentViewState();
}

Expand Down
8 changes: 8 additions & 0 deletions reader/uiframe/DocSheet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1598,6 +1598,14 @@ void DocSheet::jumpToPrevSearchResult()
m_browser->jumpToPrevSearchResult();
}

void DocSheet::closeFindWidget()
{
qCDebug(appLog) << "closeFindWidget";
stopSearch();
if (m_browser)
m_browser->hideFindWidget();
}

void DocSheet::stopSearch()
{
qCDebug(appLog) << "stopSearch";
Expand Down
6 changes: 6 additions & 0 deletions reader/uiframe/DocSheet.h
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,12 @@ class DocSheet : public Dtk::Widget::DSplitter
*/
void jumpToPrevSearchResult();

/**
* @brief closeFindWidget
* 关闭搜索框并停止搜索,切换标签页时调用
*/
void closeFindWidget();

/**
* @brief showEncryPage
* 显示解锁页面
Expand Down
Loading