aboutsummaryrefslogtreecommitdiffstats
path: root/tools/qmlscene
diff options
context:
space:
mode:
authorSamuel Gaist <samuel.gaist@edeltech.ch>2017-02-17 00:11:12 +0100
committerSamuel Gaist <samuel.gaist@edeltech.ch>2017-04-09 22:17:20 +0000
commit70a5d7bd8755c84425f473585bb05376360e6b4e (patch)
tree2a07efc773524e0251982ae878be607a8e8f7f5a /tools/qmlscene
parentcf059f045e5558231fe12607659fc67bd2259389 (diff)
Migrate to QRegularExpression
This patch updates the code base to use QRegularExpression in the place of the deprecated QRegExp class. Change-Id: I3231ac9f7902a1cd16cd4ef5f26e6cdc05e2fa4b Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
Diffstat (limited to 'tools/qmlscene')
-rw-r--r--tools/qmlscene/main.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/tools/qmlscene/main.cpp b/tools/qmlscene/main.cpp
index 7741c4c45b..ceb5e4d921 100644
--- a/tools/qmlscene/main.cpp
+++ b/tools/qmlscene/main.cpp
@@ -33,7 +33,7 @@
#include <QtCore/qpointer.h>
#include <QtCore/qscopedpointer.h>
#include <QtCore/qtextstream.h>
-#include <QtCore/qregexp.h>
+#include <QtCore/qregularexpression.h>
#include <QtGui/QGuiApplication>
#include <QtGui/QOpenGLFunctions>
@@ -259,8 +259,8 @@ static bool checkVersion(const QUrl &url)
return false;
}
- QRegExp quick1("^\\s*import +QtQuick +1\\.\\w*");
- QRegExp qt47("^\\s*import +Qt +4\\.7");
+ QRegularExpression quick1("^\\s*import +QtQuick +1\\.\\w*");
+ QRegularExpression qt47("^\\s*import +Qt +4\\.7");
QTextStream stream(&f);
bool codeFound= false;
@@ -270,10 +270,11 @@ static bool checkVersion(const QUrl &url)
codeFound = true;
} else {
QString import;
- if (quick1.indexIn(line) >= 0)
- import = quick1.cap(0).trimmed();
- else if (qt47.indexIn(line) >= 0)
- import = qt47.cap(0).trimmed();
+ QRegularExpressionMatch match = quick1.match(line);
+ if (match.hasMatch())
+ import = match.captured(0).trimmed();
+ else if ((match = qt47.match(line)).hasMatch())
+ import = match.captured(0).trimmed();
if (!import.isNull()) {
fprintf(stderr, "qmlscene: '%s' is no longer supported.\n"