File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change 1818#include < QIcon>
1919#include < QMenu>
2020#include < QMessageBox>
21+ #include < QRegularExpression>
2122#include < QSortFilterProxyModel>
2223
2324class AddressBookSortFilterProxyModel final : public QSortFilterProxyModel
@@ -46,12 +47,19 @@ class AddressBookSortFilterProxyModel final : public QSortFilterProxyModel
4647
4748 auto address = model->index (row, AddressTableModel::Address, parent);
4849
50+ #if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
51+ auto match_address = filterRegularExpression ().match (model->data (address).toString ());
52+ auto match_label = filterRegularExpression ().match (model->data (label).toString ());
53+
54+ return match_address.hasMatch () || match_label.hasMatch ();
55+ #else
4956 if (filterRegExp ().indexIn (model->data (address).toString ()) < 0 &&
5057 filterRegExp ().indexIn (model->data (label).toString ()) < 0 ) {
5158 return false ;
5259 }
5360
5461 return true ;
62+ #endif
5563 }
5664};
5765
You can’t perform that action at this time.
0 commit comments