fix: filter in external resource pages not working

For some reason, using setFilterFixedString() doesn't seem to update the
QRegularExpression object with a new value, instead leaving it empty. It
updates QRegExp just fine, so maybe that's an Qt bug? o.O

Anyway, using regex in the filter is kinda cool actually :D

Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
flow 2022-07-23 23:50:56 -03:00
parent 0e473f4570
commit 3aa2003951
No known key found for this signature in database
GPG Key ID: 8D0F221F0A59F469

View File

@ -32,13 +32,13 @@ class SortProxy : public QSortFilterProxyModel {
const auto& mod = model->at(source_row); const auto& mod = model->at(source_row);
if (mod.name().contains(filterRegularExpression())) if (filterRegularExpression().match(mod.name()).hasMatch())
return true; return true;
if (mod.description().contains(filterRegularExpression())) if (filterRegularExpression().match(mod.description()).hasMatch())
return true; return true;
for (auto& author : mod.authors()) { for (auto& author : mod.authors()) {
if (author.contains(filterRegularExpression())) { if (filterRegularExpression().match(author).hasMatch()) {
return true; return true;
} }
} }
@ -182,7 +182,7 @@ void ExternalResourcesPage::retranslate()
void ExternalResourcesPage::filterTextChanged(const QString& newContents) void ExternalResourcesPage::filterTextChanged(const QString& newContents)
{ {
m_viewFilter = newContents; m_viewFilter = newContents;
m_filterModel->setFilterFixedString(m_viewFilter); m_filterModel->setFilterRegularExpression(m_viewFilter);
} }
void ExternalResourcesPage::runningStateChanged(bool running) void ExternalResourcesPage::runningStateChanged(bool running)