diff options
author | Kai Koehne <kai.koehne@digia.com> | 2014-05-16 13:19:21 +0200 |
---|---|---|
committer | Kai Koehne <kai.koehne@digia.com> | 2014-05-21 16:44:54 +0200 |
commit | 434a7eb443ff28ffd36574470c4e0e22a20e77fb (patch) | |
tree | b5a85a774cf564576ab7ccba9b97eaad56acc842 /src/plugins/qtsupport | |
parent | 472a8e5f484320f41853d0abcaa0d86f6d0d4095 (diff) | |
download | qt-creator-434a7eb443ff28ffd36574470c4e0e22a20e77fb.tar.gz |
Detect QML runtime errors starting with 'qrc:/' too
Change 7c7d26da8b856 added support for qrc:///, but not qrc:/.
Task-number: QTCREATORBUG-11475
Change-Id: I8e75d26462fdf9fa216e6295de4341edcb430fb5
Reviewed-by: Alessandro Portale <alessandro.portale@digia.com>
Diffstat (limited to 'src/plugins/qtsupport')
-rw-r--r-- | src/plugins/qtsupport/qtoutputformatter.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/plugins/qtsupport/qtoutputformatter.cpp b/src/plugins/qtsupport/qtoutputformatter.cpp index 4a4831bdc2..0cbab0d06a 100644 --- a/src/plugins/qtsupport/qtoutputformatter.cpp +++ b/src/plugins/qtsupport/qtoutputformatter.cpp @@ -39,9 +39,14 @@ using namespace ProjectExplorer; using namespace QtSupport; +// "file" or "qrc", colon, optional '//', '/' and further characters +#define QML_URL_REGEXP \ + "(?:file|qrc):(?://)?/.+" + + QtOutputFormatter::QtOutputFormatter(ProjectExplorer::Project *project) : OutputFormatter() - , m_qmlError(QLatin1String("^((?:file|qrc):///.+" // url + , m_qmlError(QLatin1String("^(" QML_URL_REGEXP // url ":\\d+" // colon, line "(?::\\d+)?)" // colon, column (optional) "[: \t]")) // colon, space or tab @@ -187,9 +192,9 @@ void QtOutputFormatter::appendLine(QTextCursor &cursor, LinkResult lr, void QtOutputFormatter::handleLink(const QString &href) { if (!href.isEmpty()) { - QRegExp qmlLineColumnLink(QLatin1String("^((?:file|qrc):///.+)" // url - ":(\\d+)" // line - ":(\\d+)$")); // column + QRegExp qmlLineColumnLink(QLatin1String("^(" QML_URL_REGEXP ")" // url + ":(\\d+)" // line + ":(\\d+)$")); // column if (qmlLineColumnLink.indexIn(href) != -1) { const QUrl fileUrl = QUrl(qmlLineColumnLink.cap(1)); @@ -201,7 +206,7 @@ void QtOutputFormatter::handleLink(const QString &href) return; } - QRegExp qmlLineLink(QLatin1String("^((?:file|qrc):///.+)" // url + QRegExp qmlLineLink(QLatin1String("^(" QML_URL_REGEXP ")" // url ":(\\d+)$")); // line if (qmlLineLink.indexIn(href) != -1) { @@ -310,6 +315,11 @@ void QtSupportPlugin::testQtOutputFormatter_data() << -1 << -1 << QString() << QString() << -1 << -1; + QTest::newRow("qrc:/main.qml:20") + << QString::fromLatin1("qrc:/main.qml:20 Unexpected token `identifier'") + << 0 << 16 << QString::fromLatin1("qrc:/main.qml:20") + << QString::fromLatin1("/main.qml") << 20 << -1; + QTest::newRow("qrc:///main.qml:20") << QString::fromLatin1("qrc:///main.qml:20 Unexpected token `identifier'") << 0 << 18 << QString::fromLatin1("qrc:///main.qml:20") |