QmlDesigner: Implement hiding component library categories

Task-number: QDS-3822
Change-Id: I4e22385497c4e58725b7f7a62a4e4351d0b78661
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Miina Puuronen
2021-03-31 13:48:52 +03:00
parent 17e2a80e10
commit 24d88de228
9 changed files with 187 additions and 14 deletions

View File

@@ -59,6 +59,49 @@ bool ItemLibraryModel::loadExpandedState(const QString &sectionName)
return expandedStateHash.value(sectionName, true);
}
void ItemLibraryModel::saveCategoryVisibleState(bool isVisible, const QString &categoryName)
{
categoryVisibleStateHash.insert(categoryName, isVisible);
}
bool ItemLibraryModel::loadCategoryVisibleState(const QString &categoryName)
{
return categoryVisibleStateHash.value(categoryName, true);
}
void ItemLibraryModel::showHiddenCategories()
{
for (const QPointer<ItemLibraryImport> &import : std::as_const(m_importList)) {
if (import->hasCategories())
import->showAllCategories(true);
}
categoryVisibleStateHash.clear();
}
bool ItemLibraryModel::getIsAnyCategoryHidden() const
{
for (const bool &catState : std::as_const(categoryVisibleStateHash)) {
if (!catState)
return true;
}
return false;
}
bool ItemLibraryModel::isAnyCategoryHidden() const
{
return m_isAnyCategoryHidden;
}
void ItemLibraryModel::setIsAnyCategoryHidden(bool state)
{
if (state != m_isAnyCategoryHidden) {
m_isAnyCategoryHidden = state;
emit isAnyCategoryHiddenChanged();
}
}
void ItemLibraryModel::expandAll()
{
int i = 0;