Skip to content

Commit b28ceb3

Browse files
committed
fix: replace deprecated invalidateFilter in Qt6.10
1 parent c4be0bd commit b28ceb3

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

qml/models/activityfilterproxymodel.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,18 @@ void ActivityFilterProxyModel::setSearchText(const QString& search_text)
7979
{
8080
if (m_search_text == search_text) return;
8181

82+
#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0)
83+
beginFilterChange();
84+
#endif
85+
8286
m_search_text = search_text;
87+
88+
#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0)
89+
endFilterChange(QSortFilterProxyModel::Direction::Rows);
90+
#else
8391
invalidateFilter();
92+
#endif
93+
8494
Q_EMIT searchTextChanged();
8595
Q_EMIT countChanged();
8696
}
@@ -94,8 +104,16 @@ void ActivityFilterProxyModel::setDateFilter(DateFilter date_filter)
94104
{
95105
if (m_date_filter == date_filter) return;
96106

107+
#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0)
108+
beginFilterChange();
109+
#endif
110+
97111
m_date_filter = date_filter;
112+
#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0)
113+
endFilterChange(QSortFilterProxyModel::Direction::Rows);
114+
#else
98115
invalidateFilter();
116+
#endif
99117
Q_EMIT dateFilterChanged();
100118
Q_EMIT countChanged();
101119
}
@@ -109,8 +127,17 @@ void ActivityFilterProxyModel::setTypeFilter(TypeFilter type_filter)
109127
{
110128
if (m_type_filter == type_filter) return;
111129

130+
#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0)
131+
beginFilterChange();
132+
#endif
133+
112134
m_type_filter = type_filter;
135+
136+
#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0)
137+
endFilterChange(QSortFilterProxyModel::Direction::Rows);
138+
#else
113139
invalidateFilter();
140+
#endif
114141
Q_EMIT typeFilterChanged();
115142
Q_EMIT countChanged();
116143
}

0 commit comments

Comments
 (0)