From f759877336ace3ee82fcfccb760e764f0d818e59 Mon Sep 17 00:00:00 2001 From: Alexander Lohnau Date: Mon, 17 Apr 2023 21:45:18 +0200 Subject: [PATCH] smsapp/conversationlistmodel: Port to QRegularExpression In Qt5, setFilterFixedString does not change the filterRegularExpression property. Meaning we need to keep it in the Qt5 build --- smsapp/conversationssortfilterproxymodel.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/smsapp/conversationssortfilterproxymodel.cpp b/smsapp/conversationssortfilterproxymodel.cpp index 714bc4374..9946946c8 100644 --- a/smsapp/conversationssortfilterproxymodel.cpp +++ b/smsapp/conversationssortfilterproxymodel.cpp @@ -50,7 +50,7 @@ bool ConversationsSortFilterProxyModel::filterAcceptsRow(int sourceRow, const QM if (filterRole() == ConversationListModel::ConversationIdRole) { return sourceModel()->data(index, ConversationListModel::ConversationIdRole) != INVALID_THREAD_ID; } else { - if (sourceModel()->data(index, Qt::DisplayRole).toString().contains(filterRegExp())) { + if (sourceModel()->data(index, Qt::DisplayRole).toString().contains(filterRegularExpression())) { return true; } @@ -58,7 +58,11 @@ bool ConversationsSortFilterProxyModel::filterAcceptsRow(int sourceRow, const QM const QList addressList = sourceModel()->data(index, ConversationListModel::AddressesRole).value>(); for (const ConversationAddress &address : addressList) { QString canonicalAddress = SmsHelper::canonicalizePhoneNumber(address.address()); +#if QT_VERSION_MAJOR < 6 if (canonicalAddress.contains(filterRegExp())) { +#else + if (canonicalAddress.contains(filterRegularExpression())) { +#endif return true; } }