aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/qmltooling/qmldbg_preview/qqmlpreviewservice.cpp15
-rw-r--r--src/plugins/qmltooling/qmldbg_preview/qqmlpreviewservice.h1
2 files changed, 16 insertions, 0 deletions
diff --git a/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewservice.cpp b/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewservice.cpp
index 4e96fc62ef..70e895e78c 100644
--- a/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewservice.cpp
+++ b/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewservice.cpp
@@ -74,6 +74,17 @@ void QQmlPreviewServiceImpl::messageReceived(const QByteArray &data)
QByteArray contents;
packet >> path >> contents;
emit file(path, contents);
+
+ // Replace the whole scene with the first file successfully loaded over the debug
+ // connection. This is an OK approximation of the root component, and if the client wants
+ // something specific, it will send an explicit Load anyway.
+ if (m_currentUrl.isEmpty() && path.endsWith(".qml")) {
+ if (path.startsWith(':'))
+ m_currentUrl = QUrl("qrc" + path);
+ else
+ m_currentUrl = QUrl::fromLocalFile(path);
+ emit load(m_currentUrl);
+ }
break;
}
case Directory: {
@@ -86,6 +97,10 @@ void QQmlPreviewServiceImpl::messageReceived(const QByteArray &data)
case Load: {
QUrl url;
packet >> url;
+ if (url.isEmpty())
+ url = m_currentUrl;
+ else
+ m_currentUrl = url;
emit load(url);
break;
}
diff --git a/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewservice.h b/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewservice.h
index 084d3a14b1..6c35ef52dd 100644
--- a/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewservice.h
+++ b/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewservice.h
@@ -90,6 +90,7 @@ private:
QScopedPointer<QQmlPreviewFileEngineHandler> m_fileEngine;
QScopedPointer<QQmlPreviewFileLoader> m_loader;
QQmlPreviewHandler m_handler;
+ QUrl m_currentUrl;
};
QT_END_NAMESPACE