diff options
author | Christian Stenger <christian.stenger@qt.io> | 2020-07-13 14:06:55 +0200 |
---|---|---|
committer | Christian Stenger <christian.stenger@qt.io> | 2020-07-14 11:30:54 +0000 |
commit | ddc5afc4ecc48369447f01574b29ae6d39933ffd (patch) | |
tree | c6f0404f1c44a4ae575ce6c8f9b3f25e9b7f2c72 /src/plugins/qmlprofiler | |
parent | ca0f504c0e8f4389adb6cb7b3d5d315199800406 (diff) |
QmlProfiler: Replace QRegExp by QRegularExpression
Task-number: QTCREATORBUG-24098
Change-Id: I98bc7a6561c8e19da984d2efbf36d890b1f48ebf
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/plugins/qmlprofiler')
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp | 10 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofilertraceview.cpp | 9 |
2 files changed, 10 insertions, 9 deletions
diff --git a/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp b/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp index f1349d97d9..5b8735bdbb 100644 --- a/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp +++ b/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp @@ -37,7 +37,7 @@ #include <QDebug> #include <QFile> #include <QMessageBox> -#include <QRegExp> +#include <QRegularExpression> #include <QStack> #include <functional> @@ -242,10 +242,10 @@ static QString getInitialDetails(const QmlEventType &event) if (event.rangeType() == Javascript) details = QmlProfilerModelManager::tr("anonymous function"); } else { - QRegExp rewrite(QLatin1String("\\(function \\$(\\w+)\\(\\) \\{ (return |)(.+) \\}\\)")); - bool match = rewrite.exactMatch(details); - if (match) - details = rewrite.cap(1) + QLatin1String(": ") + rewrite.cap(3); + QRegularExpression rewrite(QLatin1String("^\\(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.startsWith(QLatin1String("qrc:/"))) details = details.mid(details.lastIndexOf(QLatin1Char('/')) + 1); diff --git a/src/plugins/qmlprofiler/qmlprofilertraceview.cpp b/src/plugins/qmlprofiler/qmlprofilertraceview.cpp index fc840caf80..7f5bef35c2 100644 --- a/src/plugins/qmlprofiler/qmlprofilertraceview.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertraceview.cpp @@ -67,7 +67,7 @@ #include <QQuickItem> #include <QQuickWidget> #include <QApplication> -#include <QRegExp> +#include <QRegularExpression> #include <QTextCursor> namespace QmlProfiler { @@ -403,9 +403,10 @@ bool TraceViewFindSupport::find(const QString &txt, Core::FindFlags findFlags, i bool TraceViewFindSupport::findOne(const QString &txt, Core::FindFlags findFlags, int start) { bool caseSensitiveSearch = (findFlags & Core::FindCaseSensitively); - QRegExp regexp(txt); - regexp.setPatternSyntax((findFlags & Core::FindRegularExpression) ? QRegExp::RegExp : QRegExp::FixedString); - regexp.setCaseSensitivity(caseSensitiveSearch ? Qt::CaseSensitive : Qt::CaseInsensitive); + bool regexSearch = (findFlags & Core::FindRegularExpression); + QRegularExpression regexp(regexSearch ? txt : QRegularExpression::escape(txt), + caseSensitiveSearch ? QRegularExpression::NoPatternOption + : QRegularExpression::CaseInsensitiveOption); QTextDocument::FindFlags flags; if (caseSensitiveSearch) flags |= QTextDocument::FindCaseSensitively; |