From 4a90f10df905cb03cb7c8673dabc8e72b82ed100 Mon Sep 17 00:00:00 2001 From: apa420 <17131426+apa420@users.noreply.github.com> Date: Sun, 24 Oct 2021 18:04:24 +0200 Subject: [PATCH] Fixed Searching for subcategories (#3157) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Felanbird <41973452+Felanbird@users.noreply.github.com> Co-authored-by: Paweł Co-authored-by: pajlada --- CHANGELOG.md | 1 + src/widgets/settingspages/GeneralPageView.cpp | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c33fd15..d393f7b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - Minor: Added a setting to hide similar messages by any user. (#2716) - Minor: Duplicate spaces now count towards the display message length. (#3002) - Minor: Commands are now backed up. (#3168) +- Minor: Subcategories in settings are now searchable. (#3157) - Minor: Added the ability to open an entire tab as a popup. (#3082) - Minor: Added optional parameter to /usercard command for opening a usercard in a different channel context. (#3172) - Minor: Added regex option to Nicknames. (#3146) diff --git a/src/widgets/settingspages/GeneralPageView.cpp b/src/widgets/settingspages/GeneralPageView.cpp index 963047ef..f9accba3 100644 --- a/src/widgets/settingspages/GeneralPageView.cpp +++ b/src/widgets/settingspages/GeneralPageView.cpp @@ -291,22 +291,30 @@ bool GeneralPageView::filterElements(const QString &query) QWidget *currentSubtitle = nullptr; bool currentSubtitleVisible = false; + bool currentSubtitleSearched = false; for (auto &&widget : group.widgets) { - if (dynamic_cast(widget.element)) + if (auto x = dynamic_cast(widget.element)) { + currentSubtitleSearched = false; if (currentSubtitle) currentSubtitle->setVisible(currentSubtitleVisible); currentSubtitleVisible = false; currentSubtitle = widget.element; + + if (x->text().contains(query, Qt::CaseInsensitive)) + { + currentSubtitleSearched = true; + } continue; } for (auto &&keyword : widget.keywords) { - if (keyword.contains(query, Qt::CaseInsensitive)) + if (keyword.contains(query, Qt::CaseInsensitive) || + currentSubtitleSearched) { currentSubtitleVisible = true; widget.element->show();