Reputation: 31
I have a baseclass and 3 subclasses who inherit from baseclass. Now when I save objects of these classes in an XML, I will need the class name because when i load the xml again I need it to be the correct object of course.
How can I do this? I have tried the object->metaObject()->className() but this returns me the name of the baseclass, which I of course am not seeking for?
Upvotes: 1
Views: 106
Reputation: 13130
You need to add Q_OBJECT macro for each subclass so it's own metaObject will be generated with proper class name.
Upvotes: 1