perf(frontend):优化内存占用,清除最佳匹配停止搜索时的缓存.
This commit is contained in:
parent
d464f80b11
commit
b6835305fc
|
@ -467,6 +467,7 @@ void ResultArea::initConnections()
|
||||||
m_selectedPluginID = "";
|
m_selectedPluginID = "";
|
||||||
m_isClicked = false;
|
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, &ResultArea::onWidgetSizeChanged);
|
||||||
connect(m_bestListWidget, &BestListWidget::sizeChanged, this, [=] () {
|
connect(m_bestListWidget, &BestListWidget::sizeChanged, this, [=] () {
|
||||||
QModelIndex index = m_bestListWidget->getModlIndex(0, 0);
|
QModelIndex index = m_bestListWidget->getModlIndex(0, 0);
|
||||||
|
|
|
@ -218,3 +218,15 @@ bool BestListModel::setData(const QModelIndex &index, const QVariant &value, int
|
||||||
}
|
}
|
||||||
return false;
|
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();
|
||||||
|
}
|
||||||
|
|
|
@ -53,6 +53,7 @@ public Q_SLOTS:
|
||||||
void removeInfo(const QString &);
|
void removeInfo(const QString &);
|
||||||
void moveInfo(const QString &pluginName, int pos);
|
void moveInfo(const QString &pluginName, int pos);
|
||||||
void startSearch(const QString &);
|
void startSearch(const QString &);
|
||||||
|
void stopSearchSlot();
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void stopSearch();
|
void stopSearch();
|
||||||
|
|
|
@ -273,6 +273,7 @@ void BestListView::initConnections()
|
||||||
m_model->startSearch(keyword);
|
m_model->startSearch(keyword);
|
||||||
});
|
});
|
||||||
connect(this, &BestListView::startSearch, m_model, &BestListModel::startSearch);
|
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::clicked, this, &BestListView::onRowSelectedSlot);
|
||||||
connect(this, &BestListView::activated, this, &BestListView::onRowDoubleClickedSlot);
|
connect(this, &BestListView::activated, this, &BestListView::onRowDoubleClickedSlot);
|
||||||
connect(m_model, &BestListModel::itemListChanged, this, &BestListView::onItemListChanged);
|
connect(m_model, &BestListModel::itemListChanged, this, &BestListView::onItemListChanged);
|
||||||
|
@ -418,6 +419,7 @@ void BestListWidget::initUi()
|
||||||
void BestListWidget::initConnections()
|
void BestListWidget::initConnections()
|
||||||
{
|
{
|
||||||
connect(this, &BestListWidget::startSearch, m_bestListView, &BestListView::startSearch);
|
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::startSearch, m_titleLabel, &TitleLabel::startSearch);
|
connect(this, &BestListWidget::startSearch, m_titleLabel, &TitleLabel::startSearch);
|
||||||
connect(this, &BestListWidget::stopSearch, m_titleLabel, &TitleLabel::stopSearch);
|
connect(this, &BestListWidget::stopSearch, m_titleLabel, &TitleLabel::stopSearch);
|
||||||
|
|
|
@ -73,6 +73,7 @@ private:
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void startSearch(const QString &);
|
void startSearch(const QString &);
|
||||||
|
void stopSearch();
|
||||||
void currentRowChanged(const QString &, const SearchPluginIface::ResultInfo&);
|
void currentRowChanged(const QString &, const SearchPluginIface::ResultInfo&);
|
||||||
void sendBestListData(const QString &, const SearchPluginIface::ResultInfo&);
|
void sendBestListData(const QString &, const SearchPluginIface::ResultInfo&);
|
||||||
void listLengthChanged(const int &);
|
void listLengthChanged(const int &);
|
||||||
|
|
Loading…
Reference in New Issue