diff --git a/frontend/control/stack-pages/search-page-section.cpp b/frontend/control/stack-pages/search-page-section.cpp index e50bec9..c117bf8 100644 --- a/frontend/control/stack-pages/search-page-section.cpp +++ b/frontend/control/stack-pages/search-page-section.cpp @@ -467,6 +467,7 @@ void ResultArea::initConnections() m_selectedPluginID = ""; m_isClicked = false; }); + connect(this, &ResultArea::stopSearch, m_bestListWidget, &BestListWidget::stopSearch); connect(m_bestListWidget, &BestListWidget::sizeChanged, this, &ResultArea::onWidgetSizeChanged); connect(m_bestListWidget, &BestListWidget::sizeChanged, this, [=] () { QModelIndex index = m_bestListWidget->getModlIndex(0, 0); diff --git a/frontend/model/best-list-model.cpp b/frontend/model/best-list-model.cpp index 3d4e743..a336043 100644 --- a/frontend/model/best-list-model.cpp +++ b/frontend/model/best-list-model.cpp @@ -218,3 +218,15 @@ bool BestListModel::setData(const QModelIndex &index, const QVariant &value, int } return false; } + +void BestListModel::stopSearchSlot() { + beginResetModel(); + qDeleteAll(m_items); + m_pluginIdList.clear(); + m_resourceTypes.clear(); + m_items.clear(); + m_items.squeeze(); + endResetModel(); + Q_EMIT this->itemListChanged(m_items.length()); +// Q_EMIT stopSearch(); +} diff --git a/frontend/model/best-list-model.h b/frontend/model/best-list-model.h index a11c1fa..763b1c3 100644 --- a/frontend/model/best-list-model.h +++ b/frontend/model/best-list-model.h @@ -53,6 +53,7 @@ public Q_SLOTS: void removeInfo(const QString &); void moveInfo(const QString &pluginName, int pos); void startSearch(const QString &); + void stopSearchSlot(); Q_SIGNALS: void stopSearch(); diff --git a/frontend/view/best-list-view.cpp b/frontend/view/best-list-view.cpp index 97f3673..72a98f6 100644 --- a/frontend/view/best-list-view.cpp +++ b/frontend/view/best-list-view.cpp @@ -273,6 +273,7 @@ void BestListView::initConnections() m_model->startSearch(keyword); }); connect(this, &BestListView::startSearch, m_model, &BestListModel::startSearch); + connect(this, &BestListView::stopSearch, m_model, &BestListModel::stopSearchSlot); connect(this, &BestListView::clicked, this, &BestListView::onRowSelectedSlot); connect(this, &BestListView::activated, this, &BestListView::onRowDoubleClickedSlot); connect(m_model, &BestListModel::itemListChanged, this, &BestListView::onItemListChanged); @@ -418,6 +419,7 @@ void BestListWidget::initUi() void BestListWidget::initConnections() { connect(this, &BestListWidget::startSearch, m_bestListView, &BestListView::startSearch); + connect(this, &BestListWidget::stopSearch, m_bestListView, &BestListView::stopSearch); connect(this, &BestListWidget::startSearch, m_titleLabel, &TitleLabel::startSearch); connect(this, &BestListWidget::startSearch, m_titleLabel, &TitleLabel::startSearch); connect(this, &BestListWidget::stopSearch, m_titleLabel, &TitleLabel::stopSearch); diff --git a/frontend/view/best-list-view.h b/frontend/view/best-list-view.h index 7e94829..fd7699b 100644 --- a/frontend/view/best-list-view.h +++ b/frontend/view/best-list-view.h @@ -73,6 +73,7 @@ private: Q_SIGNALS: void startSearch(const QString &); + void stopSearch(); void currentRowChanged(const QString &, const SearchPluginIface::ResultInfo&); void sendBestListData(const QString &, const SearchPluginIface::ResultInfo&); void listLengthChanged(const int &);