Fixed Searching for subcategories (#3157)

Co-authored-by: Felanbird <41973452+Felanbird@users.noreply.github.com>
Co-authored-by: Paweł <zneix@zneix.eu>
Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
apa420 2021-10-24 18:04:24 +02:00 committed by GitHub
parent 696979e9a3
commit 4a90f10df9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View file

@ -11,6 +11,7 @@
- Minor: Added a setting to hide similar messages by any user. (#2716) - Minor: Added a setting to hide similar messages by any user. (#2716)
- Minor: Duplicate spaces now count towards the display message length. (#3002) - Minor: Duplicate spaces now count towards the display message length. (#3002)
- Minor: Commands are now backed up. (#3168) - 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 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 optional parameter to /usercard command for opening a usercard in a different channel context. (#3172)
- Minor: Added regex option to Nicknames. (#3146) - Minor: Added regex option to Nicknames. (#3146)

View file

@ -291,22 +291,30 @@ bool GeneralPageView::filterElements(const QString &query)
QWidget *currentSubtitle = nullptr; QWidget *currentSubtitle = nullptr;
bool currentSubtitleVisible = false; bool currentSubtitleVisible = false;
bool currentSubtitleSearched = false;
for (auto &&widget : group.widgets) for (auto &&widget : group.widgets)
{ {
if (dynamic_cast<SubtitleLabel *>(widget.element)) if (auto x = dynamic_cast<SubtitleLabel *>(widget.element))
{ {
currentSubtitleSearched = false;
if (currentSubtitle) if (currentSubtitle)
currentSubtitle->setVisible(currentSubtitleVisible); currentSubtitle->setVisible(currentSubtitleVisible);
currentSubtitleVisible = false; currentSubtitleVisible = false;
currentSubtitle = widget.element; currentSubtitle = widget.element;
if (x->text().contains(query, Qt::CaseInsensitive))
{
currentSubtitleSearched = true;
}
continue; continue;
} }
for (auto &&keyword : widget.keywords) for (auto &&keyword : widget.keywords)
{ {
if (keyword.contains(query, Qt::CaseInsensitive)) if (keyword.contains(query, Qt::CaseInsensitive) ||
currentSubtitleSearched)
{ {
currentSubtitleVisible = true; currentSubtitleVisible = true;
widget.element->show(); widget.element->show();