PDA

View Full Version : Generic XML Serialization of QObjects



nickolais
22nd March 2011, 18:06
Hello,
I have searched the internet and forums and not come across any info about using XML serialization to generically serialize any ole QObject. This kinda perplexes me because all the needed elements appear to be within Qt. Qt has XML serialization classes and reflection through its meta data system, yet no XML serialization function that accepts a QObject.

I have 2 questions:

1) Does this sort of project already exist in the wild, and have I failed to find it?

2) If it does not exist in the wild, would there be anyone willing to work on a library with me that does just this task? My only requirement for working on such a library would be that the project be LGPL so that I could use it in my work projects.

Thanks for any links, comments on feasibility of such an undertaking, or interested parties.

high_flyer
22nd March 2011, 18:43
What exactly do you mean when you say "QObject serialization"?
What information you want to serialize?

nickolais
22nd March 2011, 19:42
The .NET framework allows you to serialize an object to an XML file, and conversely, deserialize an XML file and retrieve a persisted object. The serialized data are the values of the public properties of the object. This assumes the object's state can be represented by the public properties.

I would assume a similar approach would work well with QObjects. So I would want to serialize all the readable/writable Q_PROPERTY's because these members of a QObject could be accessed programmatically.

high_flyer
23rd March 2011, 08:47
he serialized data are the values of the public properties of the object.
There is such a thing, as its exactly what designer is doing - ui files are XML representation of forms, so its even more detailed then just having a bunch of QObjects, but QWidgets and how they relate to each other in the GUI.
Have a look at the QtDesigner module, and specifically at QFormBuilder.
http://doc.trolltech.com/4.7/qtdesigner.html