Skip to content

Commit b649103

Browse files
committed
qt: Use QRegularExpression in AddressBookSortFilterProxyModel class
1 parent f6adcad commit b649103

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/qt/addressbookpage.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <QIcon>
1919
#include <QMenu>
2020
#include <QMessageBox>
21+
#include <QRegularExpression>
2122
#include <QSortFilterProxyModel>
2223

2324
class AddressBookSortFilterProxyModel final : public QSortFilterProxyModel
@@ -46,12 +47,9 @@ class AddressBookSortFilterProxyModel final : public QSortFilterProxyModel
4647

4748
auto address = model->index(row, AddressTableModel::Address, parent);
4849

49-
if (filterRegExp().indexIn(model->data(address).toString()) < 0 &&
50-
filterRegExp().indexIn(model->data(label).toString()) < 0) {
51-
return false;
52-
}
53-
54-
return true;
50+
auto match_address = filterRegularExpression().match(model->data(address).toString());
51+
auto match_label = filterRegularExpression().match(model->data(label).toString());
52+
return match_address.hasMatch() || match_label.hasMatch();
5553
}
5654
};
5755

0 commit comments

Comments
 (0)