aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlerror.cpp
diff options
context:
space:
mode:
authorJan Arve Sæther <jan-arve.saether@qt.io>2019-07-19 12:12:05 +0200
committerJan Arve Sæther <jan-arve.saether@qt.io>2019-07-30 11:26:58 +0200
commit42872e720b2d25501587b0ed95f183d2dd9c8441 (patch)
treeaeb748eea1affd1a6cab460746e55b585332413f /src/qml/qml/qqmlerror.cpp
parentf1d213b4039e38bb9ceebaca9167fcb722a0c16e (diff)
Fix debug output for QQmlError when url is a resource
It failed to show the content of the file that had an error if the file was embedded as a resource. Change-Id: Ib8e0627919fa1f7956588ac80179adb8539df0e3 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlerror.cpp')
-rw-r--r--src/qml/qml/qqmlerror.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/qml/qml/qqmlerror.cpp b/src/qml/qml/qqmlerror.cpp
index 739d5ce4cd..0b94ed3b49 100644
--- a/src/qml/qml/qqmlerror.cpp
+++ b/src/qml/qml/qqmlerror.cpp
@@ -38,6 +38,7 @@
****************************************************************************/
#include "qqmlerror.h"
+#include "qqmlfile.h"
#include "qqmlsourcecoordinate_p.h"
#include <private/qqmljsdiagnosticmessage_p.h>
@@ -307,8 +308,8 @@ QDebug operator<<(QDebug debug, const QQmlError &error)
QUrl url = error.url();
- if (error.line() > 0 && url.scheme() == QLatin1String("file")) {
- QString file = url.toLocalFile();
+ if (error.line() > 0 && (url.scheme() == QLatin1String("file") || url.scheme() == QLatin1String("qrc"))) {
+ QString file = QQmlFile::urlToLocalFileOrQrc(url);
QFile f(file);
if (f.open(QIODevice::ReadOnly)) {
QByteArray data = f.readAll();