make text-based filter work for feed list

This commit is contained in:
Martin Rotter 2025-05-26 07:27:39 +02:00
parent 81be271c27
commit e68317fdcd

View file

@ -471,6 +471,8 @@ bool FeedsProxyModel::filterAcceptsRowInternal(int source_row, const QModelIndex
return true; return true;
} }
bool should_show = QSortFilterProxyModel::filterAcceptsRow(source_row, source_parent);
if (item->kind() == RootItem::Kind::Feed) { if (item->kind() == RootItem::Kind::Feed) {
const Feed* feed = item->toFeed(); const Feed* feed = item->toFeed();
@ -480,17 +482,18 @@ bool FeedsProxyModel::filterAcceptsRowInternal(int source_row, const QModelIndex
if (m_filters[val](feed)) { if (m_filters[val](feed)) {
// The item matches the feed filter. // The item matches the feed filter.
// Display it if it matches internal string-based filter too. // Display it if it matches internal string-based filter too.
return QSortFilterProxyModel::filterAcceptsRow(source_row, source_parent); return should_show;
} }
} }
} }
// The item does not match feed filter. if (m_filter != FeedListFilter::NoFiltering) {
// Display it only if it is selected. // Some filter is enabled but this item does not meet it.
return m_filter == FeedListFilter::NoFiltering; return false;
}
} }
return QSortFilterProxyModel::filterAcceptsRow(source_row, source_parent); return should_show;
} }
bool FeedsProxyModel::sortAlphabetically() const { bool FeedsProxyModel::sortAlphabetically() const {