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
2 changed files with 11 additions and 2 deletions
+10 -2
View File
@@ -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<SubtitleLabel *>(widget.element))
if (auto x = dynamic_cast<SubtitleLabel *>(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();