QmlDesigner: Fix searching hidden item library categories

Task-number: QDS-4136
Change-Id: I6ba2109015914af1435a03bd7a346c0eba0a8100
Reviewed-by: Miina Puuronen <miina.puuronen@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Mahmoud Badri
2021-04-19 12:58:40 +03:00
parent 332e71255e
commit 88739db142

View File

@@ -116,18 +116,17 @@ bool ItemLibraryImport::updateCategoryVisibility(const QString &searchText, bool
*changed = false; *changed = false;
for (const auto &category : m_categoryModel.categorySections()) { for (const auto &category : m_categoryModel.categorySections()) {
category->setCategoryVisible(ItemLibraryModel::loadCategoryVisibleState(category->categoryName())); bool categoryChanged = false;
bool hasVisibleItems = category->updateItemVisibility(searchText, &categoryChanged);
categoryChanged |= category->setVisible(hasVisibleItems);
if (!searchText.isEmpty() || category->isCategoryVisible()) { *changed |= categoryChanged;
bool categoryChanged = false;
bool hasVisibleItems = category->updateItemVisibility(searchText, &categoryChanged);
categoryChanged |= category->setVisible(hasVisibleItems);
*changed |= categoryChanged; if (hasVisibleItems)
hasVisibleCategories = true;
if (hasVisibleItems) if (searchText.isEmpty())
hasVisibleCategories = true; category->setCategoryVisible(ItemLibraryModel::loadCategoryVisibleState(category->categoryName()));
}
} }
return hasVisibleCategories; return hasVisibleCategories;