diff --git a/resources/buttons/search.png b/resources/buttons/search.png new file mode 100644 index 000000000..8671ce644 Binary files /dev/null and b/resources/buttons/search.png differ diff --git a/src/widgets/settingspages/GeneralPage.cpp b/src/widgets/settingspages/GeneralPage.cpp index 5c3b79e72..f86b984e7 100644 --- a/src/widgets/settingspages/GeneralPage.cpp +++ b/src/widgets/settingspages/GeneralPage.cpp @@ -144,12 +144,28 @@ bool SettingsLayout::filterElements(const QString &query) for (auto &&group : this->groups_) { + // if a description in a group matches `query` then show the entire group + bool descriptionMatches{}; + for (auto &&widget : group.widgets) + { + if (auto x = dynamic_cast(widget.element); x) + { + if (x->text().contains(query, Qt::CaseInsensitive)) + { + descriptionMatches = true; + break; + } + } + } + // if group name matches then all should be visible - if (group.name.contains(query, Qt::CaseInsensitive)) + if (group.name.contains(query, Qt::CaseInsensitive) || + descriptionMatches) { for (auto &&widget : group.widgets) widget.element->show(); group.title->show(); + any = true; } // check if any match else @@ -173,6 +189,7 @@ bool SettingsLayout::filterElements(const QString &query) } group.title->setVisible(groupAny); + any |= groupAny; } } @@ -207,7 +224,8 @@ bool GeneralPage::filterElements(const QString &query) { if (this->settingsLayout_) return this->settingsLayout_->filterElements(query) || - this->name_.contains(query) || query.isEmpty(); + this->name_.contains(query, Qt::CaseInsensitive) || + query.isEmpty(); else return false; } diff --git a/src/widgets/settingspages/SettingsPage.cpp b/src/widgets/settingspages/SettingsPage.cpp index 0d7d8d129..5a20fbf70 100644 --- a/src/widgets/settingspages/SettingsPage.cpp +++ b/src/widgets/settingspages/SettingsPage.cpp @@ -57,7 +57,7 @@ SettingsPage::SettingsPage(const QString &name, const QString &iconResource) bool SettingsPage::filterElements(const QString &query) { return filterItemsRec(this, query) || query.isEmpty() || - this->name_.contains(query); + this->name_.contains(query, Qt::CaseInsensitive); } const QString &SettingsPage::getName()