Il 29/08/2013 17:11, Martin Koller ha scritto:
However how can I do the same with this Qt::AlignmentFlag enum which is not 
defined inside a QObject ?

There's a trick in place in qnamespace.h:

http://code.woboq.org/qt5/qtbase/src/corelib/global/qnamespace.h.html#50

So: most(all?) enums under the Qt namespace gets actually extracted by moc, and placed in a special metaobject, accessible in any QObject subclass (it's protected): QObject::staticQtMetaObject.

So you can use something like

> int index = staticQtMetaObject.indexOfEnumerator("Alignment");
> QMetaEnum me = staticQtMetaObject.enumerator(index);
> ...

in a QObject subclass to get the meta information about Qt::Alignment.

Hope this helps,
--
Join us at Qt Developer Days 2013! - https://devdays.kdab.com
Giuseppe D'Angelo | giuseppe.dang...@kdab.com | Software Engineer
KDAB (UK) Ltd., a KDAB Group company
Tel. UK +44-1738-450410, Sweden (HQ) +46-563-540090
KDAB - Qt Experts - Platform-independent software solutions

Attachment: smime.p7s
Description: Firma crittografica S/MIME

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to