summaryrefslogtreecommitdiffstats
path: root/src/corelib/itemmodels
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2020-03-16 08:47:45 +0100
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2020-03-17 09:17:08 +0100
commitcfcf88e259599131b344dbbe0372d3b03f7d35ec (patch)
treef85f84f7022b4590173c90efc290e2b617aa1fe6 /src/corelib/itemmodels
parentdee55af0a5359bb3b57a89cf3065ffca9d8506da (diff)
Fix compilation with -no-feature-regularexpression
This -no-feature has probably not been tested for a while and seems to have rotted a bit, both some unprotected uses and some warnings on unused parameters. Change-Id: Ie20a06c78d3b4c36860dab49d6615eaa8ffc9077 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/itemmodels')
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp
index a5df17e386..addeeafd45 100644
--- a/src/corelib/itemmodels/qabstractitemmodel.cpp
+++ b/src/corelib/itemmodels/qabstractitemmodel.cpp
@@ -46,7 +46,9 @@
#include <qdebug.h>
#include <qvector.h>
#include <qregexp.h>
-#include <qregularexpression.h>
+#if QT_CONFIG(regularexpression)
+# include <qregularexpression.h>
+#endif
#include <qstack.h>
#include <qbitarray.h>
#include <qdatetime.h>
@@ -2359,7 +2361,9 @@ QModelIndexList QAbstractItemModel::match(const QModelIndex &start, int role,
bool wrap = flags & Qt::MatchWrap;
bool allHits = (hits == -1);
QString text; // only convert to a string if it is needed
+#if QT_CONFIG(regularexpression)
QRegularExpression rx; // only create it if needed
+#endif
const int column = start.column();
QModelIndex p = parent(start);
int from = start.row();
@@ -2377,6 +2381,7 @@ QModelIndexList QAbstractItemModel::match(const QModelIndex &start, int role,
if (value == v)
result.append(idx);
} else { // QString or regular expression based matching
+#if QT_CONFIG(regularexpression)
if (matchType == Qt::MatchRegularExpression) {
if (rx.pattern().isEmpty()) {
if (value.userType() == QMetaType::QRegularExpression) {
@@ -2392,7 +2397,9 @@ QModelIndexList QAbstractItemModel::match(const QModelIndex &start, int role,
rx.setPattern(QRegularExpression::wildcardToRegularExpression(value.toString()));
if (cs == Qt::CaseInsensitive)
rx.setPatternOptions(QRegularExpression::CaseInsensitiveOption);
- } else {
+ } else
+#endif
+ {
if (text.isEmpty()) // lazy conversion
text = value.toString();
}
@@ -2405,12 +2412,15 @@ QModelIndexList QAbstractItemModel::match(const QModelIndex &start, int role,
result.append(idx);
break;
#endif
+
+#if QT_CONFIG(regularexpression)
case Qt::MatchRegularExpression:
Q_FALLTHROUGH();
case Qt::MatchWildcard:
if (t.contains(rx))
result.append(idx);
break;
+#endif
case Qt::MatchStartsWith:
if (t.startsWith(text, cs))
result.append(idx);