forked from qt-creator/qt-creator
QmlProfiler: Replace QRegExp by QRegularExpression
Task-number: QTCREATORBUG-24098 Change-Id: I98bc7a6561c8e19da984d2efbf36d890b1f48ebf Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user