+void SyncableObject::setInitialized()
+{
+ _initialized = true;
+ emit initDone();
+}
+
+
+QVariantMap SyncableObject::toVariantMap()
+{
+ QVariantMap properties;
+
+ const QMetaObject *meta = metaObject();
+
+ // we collect data from properties
+ QMetaProperty prop;
+ QString propName;
+ for (int i = 0; i < meta->propertyCount(); i++) {
+ prop = meta->property(i);
+ propName = QString(prop.name());
+ if (propName == "objectName")
+ continue;
+ properties[propName] = prop.read(this);
+ }
+
+ // ...as well as methods, which have names starting with "init"
+ for (int i = 0; i < meta->methodCount(); i++) {
+ QMetaMethod method = meta->method(i);
+ QString methodname(SignalProxy::ExtendedMetaObject::methodName(method));
+ if (!methodname.startsWith("init") || methodname.startsWith("initSet") || methodname.startsWith("initDone"))
+ continue;
+
+ QVariant::Type variantType = QVariant::nameToType(method.typeName());
+ if (variantType == QVariant::Invalid && !QByteArray(method.typeName()).isEmpty()) {
+ qWarning() << "SyncableObject::toVariantMap(): cannot fetch init data for:" << this << method.signature() << "- Returntype is unknown to Qt's MetaSystem:" << QByteArray(method.typeName());
+ continue;
+ }