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 <QDebug>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QRegExp>
|
#include <QRegularExpression>
|
||||||
#include <QStack>
|
#include <QStack>
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
@@ -242,10 +242,10 @@ static QString getInitialDetails(const QmlEventType &event)
|
|||||||
if (event.rangeType() == Javascript)
|
if (event.rangeType() == Javascript)
|
||||||
details = QmlProfilerModelManager::tr("anonymous function");
|
details = QmlProfilerModelManager::tr("anonymous function");
|
||||||
} else {
|
} else {
|
||||||
QRegExp rewrite(QLatin1String("\\(function \\$(\\w+)\\(\\) \\{ (return |)(.+) \\}\\)"));
|
QRegularExpression rewrite(QLatin1String("^\\(function \\$(\\w+)\\(\\) \\{ (return |)(.+) \\}\\)$"));
|
||||||
bool match = rewrite.exactMatch(details);
|
QRegularExpressionMatch match = rewrite.match(details);
|
||||||
if (match)
|
if (match.hasMatch())
|
||||||
details = rewrite.cap(1) + QLatin1String(": ") + rewrite.cap(3);
|
details = match.captured(1) + QLatin1String(": ") + match.captured(3);
|
||||||
if (details.startsWith(QLatin1String("file://")) ||
|
if (details.startsWith(QLatin1String("file://")) ||
|
||||||
details.startsWith(QLatin1String("qrc:/")))
|
details.startsWith(QLatin1String("qrc:/")))
|
||||||
details = details.mid(details.lastIndexOf(QLatin1Char('/')) + 1);
|
details = details.mid(details.lastIndexOf(QLatin1Char('/')) + 1);
|
||||||
|
|||||||
@@ -67,7 +67,7 @@
|
|||||||
#include <QQuickItem>
|
#include <QQuickItem>
|
||||||
#include <QQuickWidget>
|
#include <QQuickWidget>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QRegExp>
|
#include <QRegularExpression>
|
||||||
#include <QTextCursor>
|
#include <QTextCursor>
|
||||||
|
|
||||||
namespace QmlProfiler {
|
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 TraceViewFindSupport::findOne(const QString &txt, Core::FindFlags findFlags, int start)
|
||||||
{
|
{
|
||||||
bool caseSensitiveSearch = (findFlags & Core::FindCaseSensitively);
|
bool caseSensitiveSearch = (findFlags & Core::FindCaseSensitively);
|
||||||
QRegExp regexp(txt);
|
bool regexSearch = (findFlags & Core::FindRegularExpression);
|
||||||
regexp.setPatternSyntax((findFlags & Core::FindRegularExpression) ? QRegExp::RegExp : QRegExp::FixedString);
|
QRegularExpression regexp(regexSearch ? txt : QRegularExpression::escape(txt),
|
||||||
regexp.setCaseSensitivity(caseSensitiveSearch ? Qt::CaseSensitive : Qt::CaseInsensitive);
|
caseSensitiveSearch ? QRegularExpression::NoPatternOption
|
||||||
|
: QRegularExpression::CaseInsensitiveOption);
|
||||||
QTextDocument::FindFlags flags;
|
QTextDocument::FindFlags flags;
|
||||||
if (caseSensitiveSearch)
|
if (caseSensitiveSearch)
|
||||||
flags |= QTextDocument::FindCaseSensitively;
|
flags |= QTextDocument::FindCaseSensitively;
|
||||||
|
|||||||
Reference in New Issue
Block a user