Fix QML debug info: print last QML loaded file instead of Desktop.qml

This commit is contained in:
Gabriel Calero 2018-03-02 18:04:36 -03:00
parent d64a6ecda7
commit 01699e26a5
2 changed files with 7 additions and 3 deletions

View file

@ -658,10 +658,8 @@ void OffscreenUi::createDesktop(const QUrl& url) {
#ifdef DEBUG
getSurfaceContext()->setContextProperty("DebugQML", QVariant(true));
getSurfaceContext()->setContextProperty("DebugQMLFile", QVariant(url.toString()));
#else
#else
getSurfaceContext()->setContextProperty("DebugQML", QVariant(false));
getSurfaceContext()->setContextProperty("DebugQMLFile", QVariant(""));
#endif
load(url, [=](QQmlContext* context, QObject* newObject) {

View file

@ -909,6 +909,12 @@ void OffscreenQmlSurface::loadInternal(const QUrl& qmlSource, bool createNewCont
finalQmlSource = _qmlContext->resolvedUrl(qmlSource);
}
#ifdef DEBUG
getSurfaceContext()->setContextProperty("DebugQMLFile", QVariant(finalQmlSource.toString()));
#else
getSurfaceContext()->setContextProperty("DebugQMLFile", QVariant(""));
#endif
auto targetContext = contextForUrl(finalQmlSource, parent, createNewContext);
auto qmlComponent = new QQmlComponent(_qmlContext->engine(), finalQmlSource, QQmlComponent::PreferSynchronous);
if (qmlComponent->isLoading()) {