mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 02:25:40 +01:00
qt: Use QRegularExpression
in AddressBookSortFilterProxyModel
class
Co-authored-by: João Barbosa <joao.paulo.barbosa@gmail.com>
This commit is contained in:
parent
5c5d8f2465
commit
e280087946
@ -19,6 +19,11 @@
|
|||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QSortFilterProxyModel>
|
#include <QSortFilterProxyModel>
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
|
#include <QRegularExpression>
|
||||||
|
#else
|
||||||
|
#include <QRegExp>
|
||||||
|
#endif
|
||||||
|
|
||||||
class AddressBookSortFilterProxyModel final : public QSortFilterProxyModel
|
class AddressBookSortFilterProxyModel final : public QSortFilterProxyModel
|
||||||
{
|
{
|
||||||
@ -46,12 +51,13 @@ protected:
|
|||||||
|
|
||||||
auto address = model->index(row, AddressTableModel::Address, parent);
|
auto address = model->index(row, AddressTableModel::Address, parent);
|
||||||
|
|
||||||
if (filterRegExp().indexIn(model->data(address).toString()) < 0 &&
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
filterRegExp().indexIn(model->data(label).toString()) < 0) {
|
const auto pattern = filterRegularExpression();
|
||||||
return false;
|
#else
|
||||||
}
|
const auto pattern = filterRegExp();
|
||||||
|
#endif
|
||||||
return true;
|
return (model->data(address).toString().contains(pattern) ||
|
||||||
|
model->data(label).toString().contains(pattern));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user