diff options
author | hjk <hjk@qt.io> | 2020-06-23 18:55:08 +0200 |
---|---|---|
committer | hjk <hjk@qt.io> | 2020-06-24 06:28:13 +0000 |
commit | 5dd2985a65f0bf70bc715fae138559519b96cc53 (patch) | |
tree | 111d9ee9f118ffa677beae8b628a7a53987e3995 /src/plugins/debugger/qml | |
parent | 9efa934ae099585bb63e5daeade8e4989523b961 (diff) |
Debugger: Use QRegularExpression in QmlInspector
Change-Id: Ib359738c07a5531fe66656bce5ad42c39e4a9ab2
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Diffstat (limited to 'src/plugins/debugger/qml')
-rw-r--r-- | src/plugins/debugger/qml/qmlinspectoragent.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/plugins/debugger/qml/qmlinspectoragent.cpp b/src/plugins/debugger/qml/qmlinspectoragent.cpp index 580a4c3bd4..033ce59652 100644 --- a/src/plugins/debugger/qml/qmlinspectoragent.cpp +++ b/src/plugins/debugger/qml/qmlinspectoragent.cpp @@ -50,6 +50,7 @@ #include <QElapsedTimer> #include <QFileInfo> #include <QLoggingCategory> +#include <QRegularExpression> 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); |