Skip to content

Commit 33389f1

Browse files
committed
Merge #899: Modernize custom filtering
e15e8cb qt: Modernize custom filtering (Hennadii Stepanov) Pull request description: In [`QSortFilterProxyModel::invalidateFilter()`](https://doc.qt.io/qt-6/qsortfilterproxymodel.html#invalidateFilter) is scheduled for deprecation in Qt 6.13. and emits warnings in Qt 6.10 [`QSortFilterProxyModel::beginFilterChange()`](https://doc.qt.io/qt-6/qsortfilterproxymodel.html#beginFilterChange) was introduced in Qt 6.9. [`QSortFilterProxyModel::endFilterChange()`](https://doc.qt.io/qt-6/qsortfilterproxymodel.html#endFilterChange) was introduced in Qt 6.10. Fixes bitcoin/bitcoin#33571. <img width="724" height="509" alt="image" src="https://github.com/user-attachments/assets/877740c4-7fdf-4478-963c-c639f0b80ad9" /> ACKs for top commit: maflcko: re-review ACK e15e8cb 🌿 pablomartin4btc: re-ACK e15e8cb Tree-SHA512: d31829f33292b3f9cdfb025d7b0db5fe50033752f58dbb634384ddaea0cac6f304dba7f2c8e706d1bc8bef15a4cb9162defdb7e7fee3433cd832ccc4ada737bb
2 parents 4da0112 + e15e8cb commit 33389f1

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

src/qt/transactionfilterproxy.cpp

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,32 +50,78 @@ bool TransactionFilterProxy::filterAcceptsRow(int sourceRow, const QModelIndex &
5050

5151
void TransactionFilterProxy::setDateRange(const std::optional<QDateTime>& from, const std::optional<QDateTime>& to)
5252
{
53+
#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0)
54+
beginFilterChange();
55+
#endif
56+
5357
dateFrom = from;
5458
dateTo = to;
59+
60+
#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0)
61+
endFilterChange(QSortFilterProxyModel::Direction::Rows);
62+
#else
5563
invalidateFilter();
64+
#endif
5665
}
5766

5867
void TransactionFilterProxy::setSearchString(const QString &search_string)
5968
{
6069
if (m_search_string == search_string) return;
70+
71+
#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0)
72+
beginFilterChange();
73+
#endif
74+
6175
m_search_string = search_string;
76+
77+
#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0)
78+
endFilterChange(QSortFilterProxyModel::Direction::Rows);
79+
#else
6280
invalidateFilter();
81+
#endif
6382
}
6483

6584
void TransactionFilterProxy::setTypeFilter(quint32 modes)
6685
{
86+
#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0)
87+
beginFilterChange();
88+
#endif
89+
6790
this->typeFilter = modes;
91+
92+
#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0)
93+
endFilterChange(QSortFilterProxyModel::Direction::Rows);
94+
#else
6895
invalidateFilter();
96+
#endif
6997
}
7098

7199
void TransactionFilterProxy::setMinAmount(const CAmount& minimum)
72100
{
101+
#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0)
102+
beginFilterChange();
103+
#endif
104+
73105
this->minAmount = minimum;
106+
107+
#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0)
108+
endFilterChange(QSortFilterProxyModel::Direction::Rows);
109+
#else
74110
invalidateFilter();
111+
#endif
75112
}
76113

77114
void TransactionFilterProxy::setShowInactive(bool _showInactive)
78115
{
116+
#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0)
117+
beginFilterChange();
118+
#endif
119+
79120
this->showInactive = _showInactive;
121+
122+
#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0)
123+
endFilterChange(QSortFilterProxyModel::Direction::Rows);
124+
#else
80125
invalidateFilter();
126+
#endif
81127
}

0 commit comments

Comments
 (0)