diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qmlprofiler/qmlprofilerdata.cpp | 10 | ||||
-rw-r--r-- | tools/qmlscene/main.cpp | 15 |
2 files changed, 13 insertions, 12 deletions
diff --git a/tools/qmlprofiler/qmlprofilerdata.cpp b/tools/qmlprofiler/qmlprofilerdata.cpp index 596ad8d47f..bcda0bb7fe 100644 --- a/tools/qmlprofiler/qmlprofilerdata.cpp +++ b/tools/qmlprofiler/qmlprofilerdata.cpp @@ -33,7 +33,7 @@ #include <QHash> #include <QFile> #include <QXmlStreamReader> -#include <QRegExp> +#include <QRegularExpression> #include <limits> @@ -232,10 +232,10 @@ void QmlProfilerData::addQmlEvent(QQmlProfilerDefinitions::RangeType type, if (!data.isEmpty()) { details = data.join(QLatin1Char(' ')).replace( QLatin1Char('\n'), QLatin1Char(' ')).simplified(); - QRegExp rewrite(QStringLiteral("\\(function \\$(\\w+)\\(\\) \\{ (return |)(.+) \\}\\)")); - bool match = rewrite.exactMatch(details); - if (match) { - details = rewrite.cap(1) +QLatin1String(": ") + rewrite.cap(3); + QRegularExpression rewrite(QStringLiteral("^\\(function \\$(\\w+)\\(\\) \\{ (return |)(.+) \\}\\)$")); + QRegularExpressionMatch match = rewrite.match(details); + if (match.hasMatch()) { + details = match.captured(1) +QLatin1String(": ") + match.captured(3); } if (details.startsWith(QLatin1String("file://"))) details = details.mid(details.lastIndexOf(QLatin1Char('/')) + 1); 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" |