diff --git a/src/libkwineffects/kwinoffscreenquickview.cpp b/src/libkwineffects/kwinoffscreenquickview.cpp index cdcadb14a9..acd81ec39f 100644 --- a/src/libkwineffects/kwinoffscreenquickview.cpp +++ b/src/libkwineffects/kwinoffscreenquickview.cpp @@ -624,6 +624,11 @@ OffscreenQuickScene::OffscreenQuickScene(QObject *parent, OffscreenQuickView::Ex OffscreenQuickScene::~OffscreenQuickScene() = default; void OffscreenQuickScene::setSource(const QUrl &source) +{ + setSource(source, QVariantMap()); +} + +void OffscreenQuickScene::setSource(const QUrl &source, const QVariantMap &initialProperties) { if (!d->qmlComponent) { d->qmlComponent.reset(new QQmlComponent(d->qmlEngine.data())); @@ -638,7 +643,7 @@ void OffscreenQuickScene::setSource(const QUrl &source) d->quickItem.reset(); - QScopedPointer qmlObject(d->qmlComponent->create()); + QScopedPointer qmlObject(d->qmlComponent->createWithInitialProperties(initialProperties)); QQuickItem *item = qobject_cast(qmlObject.data()); if (!item) { qCWarning(LIBKWINEFFECTS) << "Root object of effect quick view" << source << "is not a QQuickItem"; diff --git a/src/libkwineffects/kwinoffscreenquickview.h b/src/libkwineffects/kwinoffscreenquickview.h index ed42d9234e..40fa70bcfe 100644 --- a/src/libkwineffects/kwinoffscreenquickview.h +++ b/src/libkwineffects/kwinoffscreenquickview.h @@ -187,6 +187,7 @@ public: QQuickItem *rootItem() const; void setSource(const QUrl &source); + void setSource(const QUrl &source, const QVariantMap &initialProperties); private: class Private;