Commit bf33e654 authored by Marco Bubke's avatar Marco Bubke

Get in component and connect every signal to the signal watcher

This is improving the updating.
parent ae9da516
......@@ -26,10 +26,16 @@ void NodeInstanceSignalSpy::setObjectNodeInstance(const ObjectNodeInstance::Poin
void NodeInstanceSignalSpy::registerObject(QObject *spiedObject, const QString &prefix)
{
if (registeredObjectList.contains(spiedObject)) // prevent cycles
return;
registeredObjectList.append(spiedObject);
for (int index = QObject::staticMetaObject.propertyOffset();
index < spiedObject->metaObject()->propertyCount();
index++) {
QMetaProperty metaProperty = spiedObject->metaObject()->property(index);
// handle dot properties and connect the signals to the object
if (metaProperty.isReadable()
&& !metaProperty.isWritable()
&& QDeclarativeMetaType::isQObject(metaProperty.userType())) {
......@@ -43,6 +49,28 @@ void NodeInstanceSignalSpy::registerObject(QObject *spiedObject, const QString &
m_indexPropertyHash.insert(methodeOffset, prefix + metaProperty.name());
methodeOffset++;
}
// search recursive in objects
if (metaProperty.isReadable()
&& metaProperty.isWritable()
&& QDeclarativeMetaType::isQObject(metaProperty.userType())) {
QObject *propertyObject = QDeclarativeMetaType::toQObject(metaProperty.read(spiedObject));
if (propertyObject)
registerObject(propertyObject, prefix + metaProperty.name() + "/");
}
// search recursive in objects list
if (metaProperty.isReadable()
&& QDeclarativeMetaType::isList(metaProperty.userType())) {
QDeclarativeListReference list(spiedObject, metaProperty.name());
if (list.canCount() && list.canAt()) {
for (int i = 0; i < list.count(); i++) {
QObject *propertyObject = list.at(i);
if (propertyObject)
registerObject(propertyObject, prefix + metaProperty.name() + "/");
}
}
}
}
}
......
......@@ -27,6 +27,7 @@ protected:
private:
int methodeOffset;
QHash<int, QString> m_indexPropertyHash;
QObjectList registeredObjectList;
ObjectNodeInstanceWeakPointer m_objectNodeInstance;
};
......
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