kwineffects: Add OffscreenQuickScene::setSource with initial properties
Signed-off-by: Eike Hein <eike.hein@mbition.io>
This commit is contained in:
parent
19a18e4b5d
commit
0d223742ab
2 changed files with 7 additions and 1 deletions
|
@ -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<QObject> qmlObject(d->qmlComponent->create());
|
||||
QScopedPointer<QObject> qmlObject(d->qmlComponent->createWithInitialProperties(initialProperties));
|
||||
QQuickItem *item = qobject_cast<QQuickItem *>(qmlObject.data());
|
||||
if (!item) {
|
||||
qCWarning(LIBKWINEFFECTS) << "Root object of effect quick view" << source << "is not a QQuickItem";
|
||||
|
|
|
@ -187,6 +187,7 @@ public:
|
|||
QQuickItem *rootItem() const;
|
||||
|
||||
void setSource(const QUrl &source);
|
||||
void setSource(const QUrl &source, const QVariantMap &initialProperties);
|
||||
|
||||
private:
|
||||
class Private;
|
||||
|
|
Loading…
Reference in a new issue