Make MatchRegExp an alias to MatchRegularExpression

All matching happens using QRegularExpression now.

Change-Id: I10bfcefbf4d9c79d235242e3e05116cdf7af02d1
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
Lars Knoll 2020-03-18 16:56:26 +01:00
parent 2e0070d42c
commit 3532c0256d
5 changed files with 6 additions and 14 deletions

View File

@ -1560,12 +1560,12 @@ namespace Qt {
MatchContains = 1,
MatchStartsWith = 2,
MatchEndsWith = 3,
MatchRegularExpression = 4,
#if QT_DEPRECATED_SINCE(5, 15)
MatchRegExp Q_DECL_ENUMERATOR_DEPRECATED_X("MatchRegExp is deprecated. Use MatchRegularExpression instead") = 4,
MatchRegExp Q_DECL_ENUMERATOR_DEPRECATED_X("MatchRegExp is deprecated. Use MatchRegularExpression instead") = MatchRegularExpression,
#endif
MatchWildcard = 5,
MatchFixedString = 8,
MatchRegularExpression = 9,
MatchCaseSensitive = 16,
MatchWrap = 32,
MatchRecursive = 64

View File

@ -2875,8 +2875,7 @@
\value MatchStartsWith The search term matches the start of the item.
\value MatchEndsWith The search term matches the end of the item.
\value MatchCaseSensitive The search is case sensitive.
\value MatchRegExp Performs string-based matching using a regular
expression as the search term. Uses the deprecated QRegExp class.
\value MatchRegExp Same as MatchRegularExpression
\e{This enum value is deprecated since Qt 5.15.}
\value MatchRegularExpression Performs string-based matching using a regular
expression as the search term. Uses QRegularExpression.

View File

@ -2408,13 +2408,6 @@ QModelIndexList QAbstractItemModel::match(const QModelIndex &start, int role,
QString t = v.toString();
switch (matchType) {
#if QT_DEPRECATED_SINCE(5, 15)
case Qt::MatchRegExp:
if (QRegExp(text, cs).exactMatch(t))
result.append(idx);
break;
#endif
#if QT_CONFIG(regularexpression)
case Qt::MatchRegularExpression:
Q_FALLTHROUGH();

View File

@ -757,7 +757,7 @@ int QUnsortedModelEngine::buildIndices(const QString& str, const QModelIndex& pa
case Qt::MatchExactly:
case Qt::MatchFixedString:
case Qt::MatchCaseSensitive:
case Qt::MatchRegExp:
case Qt::MatchRegularExpression:
case Qt::MatchWildcard:
case Qt::MatchWrap:
case Qt::MatchRecursive:

View File

@ -449,9 +449,9 @@ void tst_QAbstractItemModel::match()
QCOMPARE(res.count(), 2);
res = model.match(start, Qt::DisplayRole, QVariant("*a*"), -1, Qt::MatchWildcard);
QCOMPARE(res.count(), 3);
res = model.match(start, Qt::DisplayRole, QVariant(".*O.*"), -1, Qt::MatchRegExp);
res = model.match(start, Qt::DisplayRole, QVariant(".*O.*"), -1, Qt::MatchRegularExpression);
QCOMPARE(res.count(), 2);
res = model.match(start, Qt::DisplayRole, QVariant(".*O.*"), -1, Qt::MatchRegExp | Qt::MatchCaseSensitive);
res = model.match(start, Qt::DisplayRole, QVariant(".*O.*"), -1, Qt::MatchRegularExpression | Qt::MatchCaseSensitive);
QCOMPARE(res.count(), 0);
res = model.match(start, Qt::DisplayRole, QVariant("BOAR"), -1, Qt::MatchFixedString);
QCOMPARE(res.count(), 1);