CollectionFilter: Move early return

This commit is contained in:
Jonas Kvinge 2024-07-15 14:16:56 +02:00
parent 3100b0c044
commit 32be33847c
1 changed files with 4 additions and 4 deletions

View File

@ -60,10 +60,6 @@ bool CollectionFilter::filterAcceptsRow(const int source_row, const QModelIndex
CollectionItem *item = model->IndexToItem(idx);
if (!item) return false;
if (item->type != CollectionItem::Type::Song) {
return item->type == CollectionItem::Type::LoadingIndicator;
}
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QString filter_text = filterRegularExpression().pattern().remove(QLatin1Char('\\'));
#else
@ -72,6 +68,10 @@ bool CollectionFilter::filterAcceptsRow(const int source_row, const QModelIndex
if (filter_text.isEmpty()) return true;
if (item->type != CollectionItem::Type::Song) {
return item->type == CollectionItem::Type::LoadingIndicator;
}
for (const QString &foperator : Operators) {
if (filter_text.contains(foperator + QLatin1Char(' '))) {
filter_text = filter_text.replace(foperator + QLatin1Char(' '), foperator);