aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquickcombobox.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2019-01-10 16:47:26 +0100
committerLiang Qi <liang.qi@qt.io>2019-01-10 16:47:26 +0100
commitefa04c2ae8427c70848477ace3d8f6e82baaab11 (patch)
treec0394c9cd5ce51961337a7a15e169074dd41632b /src/quicktemplates2/qquickcombobox.cpp
parent9c7429219d36e8eb40e1fe6e679715c89209fc40 (diff)
parent6476de0b669162cf08c11f5c8d5ad0b42419f365 (diff)
Merge remote-tracking branch 'origin/5.12' into dev
Conflicts: .qmake.conf src/imports/controls/qtquickcontrols2plugin.cpp Change-Id: I27f1260b539354e084beb28be78385e57fda63e1
Diffstat (limited to 'src/quicktemplates2/qquickcombobox.cpp')
-rw-r--r--src/quicktemplates2/qquickcombobox.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/quicktemplates2/qquickcombobox.cpp b/src/quicktemplates2/qquickcombobox.cpp
index 77abee07..ffdb7cc2 100644
--- a/src/quicktemplates2/qquickcombobox.cpp
+++ b/src/quicktemplates2/qquickcombobox.cpp
@@ -41,7 +41,7 @@
#include "qquickpopup_p_p.h"
#include "qquickdeferredexecute_p_p.h"
-#include <QtCore/qregexp.h>
+#include <QtCore/qregularexpression.h>
#include <QtCore/qabstractitemmodel.h>
#include <QtGui/qinputmethod.h>
#include <QtGui/qguiapplication.h>
@@ -573,6 +573,8 @@ int QQuickComboBoxPrivate::match(int start, const QString &text, Qt::MatchFlags
uint matchType = flags & 0x0F;
bool wrap = flags & Qt::MatchWrap;
Qt::CaseSensitivity cs = flags & Qt::MatchCaseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive;
+ QRegularExpression::PatternOptions options = flags & Qt::MatchCaseSensitive ? QRegularExpression::NoPatternOption
+ : QRegularExpression::CaseInsensitiveOption;
int from = start;
int to = q->count();
@@ -585,14 +587,19 @@ int QQuickComboBoxPrivate::match(int start, const QString &text, Qt::MatchFlags
if (t == text)
return idx;
break;
- case Qt::MatchRegExp:
- if (QRegExp(text, cs).exactMatch(t))
+ case Qt::MatchRegExp: {
+ QRegularExpression rx(QRegularExpression::anchoredPattern(text), options);
+ if (rx.match(t).hasMatch())
return idx;
break;
- case Qt::MatchWildcard:
- if (QRegExp(text, cs, QRegExp::Wildcard).exactMatch(t))
+ }
+ case Qt::MatchWildcard: {
+ QRegularExpression rx(QRegularExpression::wildcardToRegularExpression(text),
+ options);
+ if (rx.match(t).hasMatch())
return idx;
break;
+ }
case Qt::MatchStartsWith:
if (t.startsWith(text, cs))
return idx;