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

View File

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

View File

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

View File

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

View File

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

View File

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