set context proeprties before reloading the qml

doing setSource then immediately after rootContext()->setContextProperty
makes the property binding evaluated right at startup to be broken,
also fail any access to said contextproperty until the point of
Conponent.onCompleted

BUG:371763
Change-Id: Ie10afcf3c5b1693db49b5c240c9d2a4f3c47db21
This commit is contained in:
Marco Martin 2016-10-31 14:34:49 +01:00
parent 6d47160367
commit 07ae9bbc46

View File

@ -148,8 +148,8 @@ void WallpaperInterface::syncWallpaperPackage()
m_configuration = new KDeclarative::ConfigPropertyMap(configScheme(), this);
}
m_qmlObject->setSource(QUrl::fromLocalFile(m_pkg.filePath("mainscript")));
m_qmlObject->rootContext()->setContextProperty(QStringLiteral("wallpaper"), this);
m_qmlObject->setSource(QUrl::fromLocalFile(m_pkg.filePath("mainscript")));
const QString rootPath = m_pkg.metadata().property(QStringLiteral("X-Plasma-RootPath")).toString();
if (!rootPath.isEmpty()) {