feat(detailView): Clear detail widget when search list is empty.

Description: 当搜索结果列表为空时清空详情页

Log: 当搜索结果列表为空时清空详情页
This commit is contained in:
zhangjiaping 2020-12-28 15:37:19 +08:00
parent 65021e829c
commit 5918dec5bf
2 changed files with 6 additions and 1 deletions

View File

@ -12,11 +12,11 @@ public:
~SearchDetailView();
void setupWidget(const int&, const QString&);
void clearLayout();
private:
QVBoxLayout * m_layout = nullptr;
void clearLayout();
bool openAction(const int&, const QString&);
bool addDesktopShortcut(const QString&);
bool addPanelShortcut(const QString&);

View File

@ -135,10 +135,12 @@ void ContentWidget::refreshSearchList(const QVector<int>& types, const QVector<Q
if (!m_listLyt->isEmpty()) {
clearSearchList();
}
bool isEmpty = true;
for (int i = 0; i < types.count(); i ++) {
if (lists.at(i).isEmpty()) {
continue;
}
isEmpty = false;
SearchListView * searchList = new SearchListView(m_resultList, lists.at(i), types.at(i)); //Treeview
QLabel * titleLabel = new QLabel(m_resultList); //表头
titleLabel->setContentsMargins(8, 0, 0, 0);
@ -156,6 +158,9 @@ void ContentWidget::refreshSearchList(const QVector<int>& types, const QVector<Q
m_detailView->setupWidget(type, path);
});
}
if (isEmpty) {
m_detailView->clearLayout(); //没有搜到结果,清空详情页
}
}
/**