Results 1 to 4 of 4

Thread: Generic XML Serialization of QObjects

  1. #1
    Join Date
    Feb 2009
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Generic XML Serialization of QObjects

    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.

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Generic XML Serialization of QObjects

    What exactly do you mean when you say "QObject serialization"?
    What information you want to serialize?
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Feb 2009
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Generic XML Serialization of QObjects

    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.

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Generic XML Serialization of QObjects

    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
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. Find QObjects that insatlled event filter
    By babu198649 in forum Qt Programming
    Replies: 4
    Last Post: 15th December 2010, 11:27
  2. Generic-enough QAbstractItemModel.
    By hickscorp in forum Qt Programming
    Replies: 0
    Last Post: 5th November 2010, 04:55
  3. Generic way to talk to a still camera
    By scarleton in forum Qt Programming
    Replies: 2
    Last Post: 2nd September 2010, 23:36
  4. Replies: 4
    Last Post: 24th August 2010, 15:28
  5. QObjects as data members stored by value
    By Radagast in forum Qt Programming
    Replies: 3
    Last Post: 6th August 2009, 19:14

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.