Switch to lightweight function for filtering data

We can use this function since the columns doesn't change.

PR #20518.
This commit is contained in:
Chocobo1 2024-03-11 12:54:38 +08:00 committed by GitHub
parent c06817f4eb
commit 0967bdc715
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 9 deletions

View file

@ -39,7 +39,7 @@ LogFilterModel::LogFilterModel(const Log::MsgTypes types, QObject *parent)
void LogFilterModel::setMessageTypes(const Log::MsgTypes types) void LogFilterModel::setMessageTypes(const Log::MsgTypes types)
{ {
m_types = types; m_types = types;
invalidateFilter(); invalidateRowsFilter();
} }
bool LogFilterModel::filterAcceptsRow(const int sourceRow, const QModelIndex &sourceParent) const bool LogFilterModel::filterAcceptsRow(const int sourceRow, const QModelIndex &sourceParent) const

View file

@ -112,46 +112,46 @@ void TransferListSortModel::sort(const int column, const Qt::SortOrder order)
QSortFilterProxyModel::sort(column, order); QSortFilterProxyModel::sort(column, order);
} }
void TransferListSortModel::setStatusFilter(TorrentFilter::Type filter) void TransferListSortModel::setStatusFilter(const TorrentFilter::Type filter)
{ {
if (m_filter.setType(filter)) if (m_filter.setType(filter))
invalidateFilter(); invalidateRowsFilter();
} }
void TransferListSortModel::setCategoryFilter(const QString &category) void TransferListSortModel::setCategoryFilter(const QString &category)
{ {
if (m_filter.setCategory(category)) if (m_filter.setCategory(category))
invalidateFilter(); invalidateRowsFilter();
} }
void TransferListSortModel::disableCategoryFilter() void TransferListSortModel::disableCategoryFilter()
{ {
if (m_filter.setCategory(TorrentFilter::AnyCategory)) if (m_filter.setCategory(TorrentFilter::AnyCategory))
invalidateFilter(); invalidateRowsFilter();
} }
void TransferListSortModel::setTagFilter(const Tag &tag) void TransferListSortModel::setTagFilter(const Tag &tag)
{ {
if (m_filter.setTag(tag)) if (m_filter.setTag(tag))
invalidateFilter(); invalidateRowsFilter();
} }
void TransferListSortModel::disableTagFilter() void TransferListSortModel::disableTagFilter()
{ {
if (m_filter.setTag(TorrentFilter::AnyTag)) if (m_filter.setTag(TorrentFilter::AnyTag))
invalidateFilter(); invalidateRowsFilter();
} }
void TransferListSortModel::setTrackerFilter(const QSet<BitTorrent::TorrentID> &torrentIDs) void TransferListSortModel::setTrackerFilter(const QSet<BitTorrent::TorrentID> &torrentIDs)
{ {
if (m_filter.setTorrentIDSet(torrentIDs)) if (m_filter.setTorrentIDSet(torrentIDs))
invalidateFilter(); invalidateRowsFilter();
} }
void TransferListSortModel::disableTrackerFilter() void TransferListSortModel::disableTrackerFilter()
{ {
if (m_filter.setTorrentIDSet(TorrentFilter::AnyID)) if (m_filter.setTorrentIDSet(TorrentFilter::AnyID))
invalidateFilter(); invalidateRowsFilter();
} }
int TransferListSortModel::compare(const QModelIndex &left, const QModelIndex &right) const int TransferListSortModel::compare(const QModelIndex &left, const QModelIndex &right) const