feat(detailView): Clear detail widget when search list is empty.
Description: 当搜索结果列表为空时清空详情页 Log: 当搜索结果列表为空时清空详情页
This commit is contained in:
parent
65021e829c
commit
5918dec5bf
|
@ -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&);
|
||||
|
|
|
@ -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(); //没有搜到结果,清空详情页
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue