In order to create mapping between classes and their properties you need to traverse through your object's class hierarchy. Here is the sample code that crates such mapping:
// Create properties per class mapping for the initialObject.
const QMetaObject *mo = initialObject->metaObject();
QMap<QString, QStringList> propertyMap;
do {
QStringList properties;
for(int i = mo->propertyOffset(); i < mo->propertyCount(); ++i) {
properties << QString::fromLatin1(mo->property(i).name());
}
propertyMap[mo->className()] = properties;
} while (mo = mo->superClass());
Now the propertyMap
contains all properties sorted by the class names they belong to.