QmlDesigner: Remove unnecessary method param

Introduced by d37f6648f3

Change-Id: Ib2f824c0a3755f4551b93f700bd0bb719a099003
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Mahmoud Badri
2021-03-19 14:40:06 +02:00
parent 9e960d09a3
commit e43a67447f
6 changed files with 11 additions and 11 deletions

View File

@@ -60,7 +60,7 @@ QObject *ItemLibraryCategory::itemModel()
return &m_itemModel;
}
bool ItemLibraryCategory::updateItemVisibility(const QString &searchText, bool *changed, bool expand)
bool ItemLibraryCategory::updateItemVisibility(const QString &searchText, bool *changed)
{
bool hasVisibleItems = false;
@@ -81,7 +81,7 @@ bool ItemLibraryCategory::updateItemVisibility(const QString &searchText, bool *
}
// expand category if it has an item matching search criteria
if (expand && hasVisibleItems && !categoryExpanded())
if (!searchText.isEmpty() && hasVisibleItems && !categoryExpanded())
setExpanded(true);
return hasVisibleItems;

View File

@@ -50,7 +50,7 @@ public:
void addItem(ItemLibraryItem *item);
QObject *itemModel();
bool updateItemVisibility(const QString &searchText, bool *changed, bool expand = false);
bool updateItemVisibility(const QString &searchText, bool *changed);
bool setVisible(bool isVisible);
bool isVisible() const;

View File

@@ -110,14 +110,14 @@ void ItemLibraryImport::expandCategories(bool expand)
m_categoryModel.expandCategories(expand);
}
bool ItemLibraryImport::updateCategoryVisibility(const QString &searchText, bool *changed, bool expand)
bool ItemLibraryImport::updateCategoryVisibility(const QString &searchText, bool *changed)
{
bool hasVisibleCategories = false;
*changed = false;
for (const auto &category : m_categoryModel.categorySections()) {
bool categoryChanged = false;
bool hasVisibleItems = category->updateItemVisibility(searchText, &categoryChanged, expand);
bool hasVisibleItems = category->updateItemVisibility(searchText, &categoryChanged);
categoryChanged |= category->setVisible(hasVisibleItems);
*changed |= categoryChanged;

View File

@@ -70,7 +70,7 @@ public:
void addCategory(ItemLibraryCategory *category);
QObject *categoryModel();
bool updateCategoryVisibility(const QString &searchText, bool *changed, bool expand = false);
bool updateCategoryVisibility(const QString &searchText, bool *changed);
bool setVisible(bool isVisible);
void setImportUsed(bool importUsed);
void sortCategorySections();

View File

@@ -163,7 +163,7 @@ void ItemLibraryModel::setSearchText(const QString &searchText)
m_searchText = lowerSearchText;
bool changed = false;
updateVisibility(&changed, !m_searchText.isEmpty());
updateVisibility(&changed);
}
}
@@ -401,18 +401,18 @@ void ItemLibraryModel::updateUsedImports(const QList<Import> &usedImports)
}
}
void ItemLibraryModel::updateVisibility(bool *changed, bool expand)
void ItemLibraryModel::updateVisibility(bool *changed)
{
for (ItemLibraryImport *import : std::as_const(m_importList)) {
bool categoryChanged = false;
bool hasVisibleItems = import->updateCategoryVisibility(m_searchText, &categoryChanged, expand);
bool hasVisibleItems = import->updateCategoryVisibility(m_searchText, &categoryChanged);
*changed |= categoryChanged;
if (import->sectionType() == ItemLibraryImport::SectionType::Unimported)
*changed |= import->setVisible(!m_searchText.isEmpty());
// expand import if it has an item matching search criteria
if (expand && hasVisibleItems && !import->importExpanded())
if (!m_searchText.isEmpty() && hasVisibleItems && !import->importExpanded())
import->setImportExpanded();
}

View File

@@ -72,7 +72,7 @@ public:
Import entryToImport(const ItemLibraryEntry &entry);
private:
void updateVisibility(bool *changed, bool expand = false);
void updateVisibility(bool *changed);
void addRoleNames();
void sortSections();
void clearSections();