Commit f6b80018 authored by Marco Bubke's avatar Marco Bubke

QmlDesigner.NodeInstances: Cache qml meta types

Change-Id: Ied18ca8b31e3a17ee9e37aed030377148d272917
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@digia.com>
parent 4d76f0db
......@@ -54,6 +54,7 @@
#include <private/qquicktransition_p.h>
#include <private/qquickanimation_p.h>
#include <private/qquicktimer_p.h>
#include <private/qqmlengine_p.h>
namespace QmlDesigner {
namespace Internal {
......@@ -131,11 +132,13 @@ void ObjectNodeInstance::initializePropertyWatcher(const ObjectNodeInstance::Poi
{
const QMetaObject *metaObject = objectNodeInstance->object()->metaObject();
m_metaObject = new NodeInstanceMetaObject(objectNodeInstance, nodeInstanceServer()->engine());
QQmlEnginePrivate::get(engine())->cache(m_metaObject);
for (int propertyIndex = QObject::staticMetaObject.propertyCount(); propertyIndex < metaObject->propertyCount(); propertyIndex++) {
if (QQmlMetaType::isQObject(metaObject->property(propertyIndex).userType())) {
QObject *propertyObject = QQmlMetaType::toQObject(metaObject->property(propertyIndex).read(objectNodeInstance->object()));
if (propertyObject && hasPropertiesWitoutNotifications(propertyObject->metaObject())) {
new NodeInstanceMetaObject(objectNodeInstance, propertyObject, metaObject->property(propertyIndex).name(), nodeInstanceServer()->engine());
QMetaObject *childMetaObject = new NodeInstanceMetaObject(objectNodeInstance, propertyObject, metaObject->property(propertyIndex).name(), nodeInstanceServer()->engine());
QQmlEnginePrivate::get(engine())->cache(childMetaObject);
}
}
}
......
......@@ -38,6 +38,7 @@
#include "qmlstatenodeinstance.h"
#include "anchorchangesnodeinstance.h"
#include "quickitemnodeinstance.h"
#include "nodeinstanceserver.h"
......@@ -50,6 +51,7 @@
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
#include <QQuickItem>
#endif
#include <private/qqmlengine_p.h>
#include <QQmlEngine>
......@@ -226,6 +228,8 @@ ServerNodeInstance ServerNodeInstance::create(NodeInstanceServer *nodeInstanceSe
object = Internal::ObjectNodeInstance::createPrimitive("QtQuick/Item", 1, 0, nodeInstanceServer->context());
#endif
QQmlEnginePrivate::get(nodeInstanceServer->engine())->cache(object->metaObject());
ServerNodeInstance instance(createInstance(object));
instance.internalInstance()->setNodeInstanceServer(nodeInstanceServer);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment