[Qt-interest] introspection of enums and flags from QVariant?
André Somers
andre at familiesomers.nl
Sun Feb 7 16:17:37 CET 2010
Hi,
Im contemplating the following:
I am writing some code that deals with QVariants. Of course, you can put
pretty much anything in there. You can also register enums and flags to the
meta type system. However, I notice that introspection on these only seems
possible using the QMetaObject methods if these flags or enums are used as
properties. I would like to be able to do this introspection also on enums
and flags that are just passed around as values in my application. Is that
possible? I did not notice any method to get to the QMetaEnum from a QFlags
class. Am I overlooking something?
One use case of this would be a data backend that can deal with registered
types. It would for instance be nice if one could write out the symbolic
values to the data file instead of just a numerical representation, to make
it more readable. These symbols are available in QMetaEnum, but I dont see
a way to access them without going through QMetaObject. It may be possible
by creating a temporary QObject, set the value as a property, and then going
through the QMetaObject -> properties -> enumerator route, but that looks
dirty. Im not even sure it would work.
André
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100207/be6ff2e0/attachment.html
More information about the Qt-interest-old
mailing list