diff --git a/src/gui/log/logfiltermodel.cpp b/src/gui/log/logfiltermodel.cpp index 6c923735f..46060e8e8 100644 --- a/src/gui/log/logfiltermodel.cpp +++ b/src/gui/log/logfiltermodel.cpp @@ -28,6 +28,8 @@ #include "logfiltermodel.h" +#include + #include "logmodel.h" LogFilterModel::LogFilterModel(const Log::MsgTypes types, QObject *parent) @@ -38,8 +40,14 @@ LogFilterModel::LogFilterModel(const Log::MsgTypes types, QObject *parent) void LogFilterModel::setMessageTypes(const Log::MsgTypes types) { +#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0) + beginFilterChange(); + m_types = types; + endFilterChange(Direction::Rows); +#else m_types = types; invalidateRowsFilter(); +#endif } bool LogFilterModel::filterAcceptsRow(const int sourceRow, const QModelIndex &sourceParent) const diff --git a/src/gui/transferlistsortmodel.cpp b/src/gui/transferlistsortmodel.cpp index 782aead74..ca222dd8e 100644 --- a/src/gui/transferlistsortmodel.cpp +++ b/src/gui/transferlistsortmodel.cpp @@ -30,6 +30,7 @@ #include +#include #include #include "base/bittorrent/infohash.h" @@ -125,44 +126,86 @@ void TransferListSortModel::sort(const int column, const Qt::SortOrder order) void TransferListSortModel::setStatusFilter(const TorrentFilter::Type filter) { +#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0) + beginFilterChange(); + m_filter.setType(filter); + endFilterChange(Direction::Rows); +#else if (m_filter.setType(filter)) invalidateRowsFilter(); +#endif } void TransferListSortModel::setCategoryFilter(const QString &category) { +#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0) + beginFilterChange(); + m_filter.setCategory(category); + endFilterChange(Direction::Rows); +#else if (m_filter.setCategory(category)) invalidateRowsFilter(); +#endif } void TransferListSortModel::disableCategoryFilter() { +#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0) + beginFilterChange(); + m_filter.setCategory(TorrentFilter::AnyCategory); + endFilterChange(Direction::Rows); +#else if (m_filter.setCategory(TorrentFilter::AnyCategory)) invalidateRowsFilter(); +#endif } void TransferListSortModel::setTagFilter(const Tag &tag) { +#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0) + beginFilterChange(); + m_filter.setTag(tag); + endFilterChange(Direction::Rows); +#else if (m_filter.setTag(tag)) invalidateRowsFilter(); +#endif } void TransferListSortModel::disableTagFilter() { +#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0) + beginFilterChange(); + m_filter.setTag(TorrentFilter::AnyTag); + endFilterChange(Direction::Rows); +#else if (m_filter.setTag(TorrentFilter::AnyTag)) invalidateRowsFilter(); +#endif } void TransferListSortModel::setTrackerFilter(const QSet &torrentIDs) { +#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0) + beginFilterChange(); + m_filter.setTorrentIDSet(torrentIDs); + endFilterChange(Direction::Rows); +#else if (m_filter.setTorrentIDSet(torrentIDs)) invalidateRowsFilter(); +#endif } void TransferListSortModel::disableTrackerFilter() { +#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0) + beginFilterChange(); + m_filter.setTorrentIDSet(TorrentFilter::AnyID); + endFilterChange(Direction::Rows); +#else if (m_filter.setTorrentIDSet(TorrentFilter::AnyID)) invalidateRowsFilter(); +#endif } int TransferListSortModel::compare(const QModelIndex &left, const QModelIndex &right) const