QmlPuppet: Register callback for notifyPropertyChange

MetaObject cannot have a dependency on ObjectNodeInstance.
Instead we register a callback.

Change-Id: I9f6e096c67caf1abd525201c9bacd363d31a2fa2
Reviewed-by: Alessandro Portale <alessandro.portale@theqtcompany.com>
This commit is contained in:
Thomas Hartmann
2015-05-21 11:47:27 +02:00
committed by Thomas Hartmann
parent 0321f6e1a7
commit c9eb75e2f8
5 changed files with 31 additions and 2 deletions
@@ -110,6 +110,16 @@ namespace {
namespace QmlDesigner {
static NodeInstanceServer *nodeInstanceServerInstance = 0;
static void notifyPropertyChangeCallBackFunction(QObject *object, const PropertyName &propertyName)
{
qint32 id = nodeInstanceServerInstance->instanceForObject(object).instanceId();
nodeInstanceServerInstance->notifyPropertyChange(id, propertyName);
}
static void (*notifyPropertyChangeCallBackPointer)(QObject *, const PropertyName &) = &notifyPropertyChangeCallBackFunction;
NodeInstanceServer::NodeInstanceServer(NodeInstanceClientInterface *nodeInstanceClient) :
NodeInstanceServerInterface(),
m_childrenChangeEventFilter(new Internal::ChildrenChangeEventFilter(this)),
@@ -122,6 +132,8 @@ NodeInstanceServer::NodeInstanceServer(NodeInstanceClientInterface *nodeInstance
qmlRegisterType<DummyContextObject>("QmlDesigner", 1, 0, "DummyContextObject");
connect(m_childrenChangeEventFilter.data(), SIGNAL(childrenChanged(QObject*)), this, SLOT(emitParentChanged(QObject*)));
nodeInstanceServerInstance = this;
Internal::QmlPrivateGate::registerNotifyPropertyChangeCallBack(notifyPropertyChangeCallBackPointer);
}
NodeInstanceServer::~NodeInstanceServer()