-QVariantMap SignalProxy::initData(QObject *obj) const {
- QVariantMap properties;
-
- const QMetaObject* meta = obj->metaObject();
-
- // we collect data from properties
- for(int i = 0; i < meta->propertyCount(); i++) {
- QMetaProperty prop = meta->property(i);
- properties[QString(prop.name())] = prop.read(obj);
- }
-
- // ...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(::methodName(method));
- if(!methodname.startsWith("init") || methodname.startsWith("initSet"))
- continue;
-
- QVariant value = QVariant(QVariant::nameToType(method.typeName()));
- QGenericReturnArgument genericvalue = QGenericReturnArgument(method.typeName(), &value);
- QMetaObject::invokeMethod(obj, methodname.toAscii(), genericvalue);
-
- properties[methodBaseName(method)] = value;
- // qDebug() << ">>> SYNC:" << methodBaseName(method) << value;
- }
-
- // properties["Payload"] = QByteArray(10000000, 'a'); // for testing purposes
- return properties;