From 5dd2985a65f0bf70bc715fae138559519b96cc53 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 23 Jun 2020 18:55:08 +0200 Subject: [PATCH] Debugger: Use QRegularExpression in QmlInspector Change-Id: Ib359738c07a5531fe66656bce5ad42c39e4a9ab2 Reviewed-by: Kai Koehne --- src/plugins/debugger/qml/qmlinspectoragent.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/plugins/debugger/qml/qmlinspectoragent.cpp b/src/plugins/debugger/qml/qmlinspectoragent.cpp index 580a4c3bd4e..033ce596522 100644 --- a/src/plugins/debugger/qml/qmlinspectoragent.cpp +++ b/src/plugins/debugger/qml/qmlinspectoragent.cpp @@ -50,6 +50,7 @@ #include #include #include +#include using namespace QmlDebug; using namespace QmlDebug::Constants; @@ -555,10 +556,11 @@ void QmlInspectorAgent::buildDebugIdHashRecursive(const ObjectReference &ref) // handle the case where the url contains the revision number encoded. // (for object created by the debugger) - static QRegExp rx("(.*)_(\\d+):(\\d+)$"); - if (rx.exactMatch(fileUrl.path())) { - fileUrl.setPath(rx.cap(1)); - lineNum += rx.cap(3).toInt() - 1; + const QRegularExpression rx("^(.*)_(\\d+):(\\d+)$"); + const QRegularExpressionMatch match = rx.match(fileUrl.path()); + if (match.hasMatch()) { + fileUrl.setPath(match.captured(1)); + lineNum += match.captured(3).toInt() - 1; } const QString filePath = m_qmlEngine->toFileInProject(fileUrl);