diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2016-06-15 16:32:56 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-06-17 18:51:51 +0000 |
commit | 47744a1d5c91cad58b94ba3cc3b886793789e870 (patch) | |
tree | 89f8689122b28859024cf68bd76eea6ac73c0c3d /src/quicktemplates2/qquickstackview_p.cpp | |
parent | a3f27162103286bf4a3f0a74ee44b29077888da2 (diff) |
Make use of QQmlComponentPrivate::setInitialProperties()
It is no longer necessary to create a useless QQmlComponent instance
just to be able to call initializeObjectWithInitialProperties(). We
can now use the static setInitialProperties() instead.
Change-Id: I3e1f981adfb04a0aa38642a17aeb19388b9fada1
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/quicktemplates2/qquickstackview_p.cpp')
-rw-r--r-- | src/quicktemplates2/qquickstackview_p.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/quicktemplates2/qquickstackview_p.cpp b/src/quicktemplates2/qquickstackview_p.cpp index 96f70d80..c781f7fe 100644 --- a/src/quicktemplates2/qquickstackview_p.cpp +++ b/src/quicktemplates2/qquickstackview_p.cpp @@ -119,12 +119,9 @@ QQuickStackElement *QQuickStackElement::fromString(const QString &str, QQuickSta QQuickStackElement *QQuickStackElement::fromObject(QObject *object, QQuickStackView *view) { + Q_UNUSED(view); QQuickStackElement *element = new QQuickStackElement; element->component = qobject_cast<QQmlComponent *>(object); - if (!element->component) { - element->component = new QQmlComponent(qmlEngine(view), view); - element->ownComponent = true; - } element->item = qobject_cast<QQuickItem *>(object); if (element->item) element->originalParent = element->item->parentItem(); @@ -176,14 +173,15 @@ void QQuickStackElement::initialize() p->addItemChangeListener(this, QQuickItemPrivate::Destroyed); if (!properties.isUndefined()) { - QQmlComponentPrivate *d = QQmlComponentPrivate::get(component); - Q_ASSERT(d && d->engine); - QV4::ExecutionEngine *v4 = QQmlEnginePrivate::getV4Engine(d->engine); + QQmlEngine *engine = qmlEngine(view); + Q_ASSERT(engine); + QV4::ExecutionEngine *v4 = QQmlEnginePrivate::getV4Engine(engine); Q_ASSERT(v4); QV4::Scope scope(v4); QV4::ScopedValue ipv(scope, properties.value()); QV4::Scoped<QV4::QmlContext> qmlContext(scope, qmlCallingContext.value()); - d->initializeObjectWithInitialProperties(qmlContext, ipv, item); + QV4::ScopedValue qmlObject(scope, QV4::QObjectWrapper::wrap(v4, item)); + QQmlComponentPrivate::setInitialProperties(v4, qmlContext, qmlObject, ipv); properties.clear(); } |