File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change 19
19
#include < QMenu>
20
20
#include < QMessageBox>
21
21
#include < QSortFilterProxyModel>
22
+ #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
23
+ #include < QRegularExpression>
24
+ #else
25
+ #include < QRegExp>
26
+ #endif
22
27
23
28
class AddressBookSortFilterProxyModel final : public QSortFilterProxyModel
24
29
{
@@ -46,12 +51,13 @@ class AddressBookSortFilterProxyModel final : public QSortFilterProxyModel
46
51
47
52
auto address = model->index (row, AddressTableModel::Address, parent);
48
53
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 ;
54
+ #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
55
+ const auto pattern = filterRegularExpression ();
56
+ #else
57
+ const auto pattern = filterRegExp ();
58
+ #endif
59
+ return (model->data (address).toString ().contains (pattern) ||
60
+ model->data (label).toString ().contains (pattern));
55
61
}
56
62
};
57
63
You can’t perform that action at this time.
0 commit comments