[Qt5-feedback] User-defined meta data for QMetaProperty
Jason H
scorp1us at yahoo.com
Wed Jun 1 21:59:51 CEST 2011
1. Ok.
2. Well, maybe it should have been :-)
My understanding is if you adjust the QMetaObject system in a way that you can have code generate types at run-time, you can then have a universal structured memory storage format which can then be directly mapped to
any sort of persistence.
Currently, we use
structs (or classes) or XML to map structured data to and from files. If we use XML, then we have to parse the tree to create a DOM structure,
which is "heavy" and needs the XML DOM API to be navigated. Now lets
consider EXIF data. I need to know how to parse EXIF based on some EXIF
API. I imagine a new approach where all data formats are expressed as a QObject-based structure, where I operate on the data without regard to where/how it was serialized. If I want to persist it, then I can have it serialized in any format. For all of Qt, and all
projects, I just need to write a QMetaObject::toXml() function once.
Same goes for QMetaObject::toExif(), etc.
If I have a customer who wants me to write a EXIF to XML converter, all I need to do is:
QMetaObject o = QMetaObject::fromImage(inFile);
if (metaDataOnly)
QMetaObject::findChildNode(o, "pixelData").remove(); // assuming the pixel data is stored as a root
key of o, in a node called "pixelData"
outFile.write(o.toXml());
Even if the QMetaObject serialization doesn't produce niche-compliant XML, you can always apply niche-specific XSLT later.
Am I thinking too far outside the box?
________________________________
From: Andre Somers <andre at familiesomers.nl>
To: "qt5-feedback at qt.nokia.com" <qt5-feedback at qt.nokia.com>
Sent: Wednesday, June 1, 2011 3:26 PM
Subject: Re: [Qt5-feedback] User-defined meta data for QMetaProperty
Hi,
Op 1-6-2011 21:05, Jason H schreef:
Oh Addemdum to my previous message:
>QObjects as a row object from SQL queries?
Way to heavy for general usage, if you ask me.
Couldn't we then use QObjects as a storage medium for general structured data, say as a universal format. THen we can write generic XML/binary readers/writers.
>
>
>No?
>
>
Not sure how that would help you. My suggestion was about an extension to the Qt Meta object system, not about using QObject for everything.
André
>________________________________
>From: Andre Somers <andre at familiesomers.nl>
>To: qt5-feedback at qt.nokia.com
>Sent: Wednesday, June 1, 2011 4:44 AM
>Subject: [Qt5-feedback] User-defined meta data for QMetaProperty
>
>Hi,
>
>When defining properties, one can set a couple of flags like
STORED and
>DESIGNABLE. For certain applications, I found that it would
be very useful
>if this mechanism were somehow extendable to include
arbitrairy other
>pieces of data. A main use would be applying to make more
powerful
>property editors without having to create a new hierarchy of
data or
>adaptor classes on top of the already existing QObject meta
data.
>
>Do others here see uses for such a mechanism? Do you think
it doable to
>add that?
>
>André
>
>
>_______________________________________________
>Qt5-feedback mailing list
>Qt5-feedback at qt.nokia.com
>http://lists.qt.nokia.com/mailman/listinfo/qt5-feedback
>
>
>
_______________________________________________
Qt5-feedback mailing list
Qt5-feedback at qt.nokia.com
http://lists.qt.nokia.com/mailman/listinfo/qt5-feedback
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt5-feedback/attachments/20110601/03f9eb51/attachment-0001.html
More information about the Qt5-feedback
mailing list