[Interest] Accessing staticMetaObject of Q_GADGET class by name or TypeID

Thiago Macieira thiago.macieira at intel.com
Wed Jan 23 01:11:00 CET 2013


On terça-feira, 22 de janeiro de 2013 18.51.15, Shady Zayat wrote:
> Is there a way to access the QMetaObject for a non QObject subclass that
> has the Q_GADGET macro, in runtime, by class name or by type id? I'm
> looking for something similar to
>  const QMetaObject * QMetaType::metaObjectForType(int type)

There's no central registration of QMetaObjects in Qt.

If you want that, you need to create the registration yourself in your own 
application or library.

> What I'm trying to write here is a generic function that returns the string
> value of Q_ENUMS stored in a QVariant. Any hints appreciated.

And you're trying to do this generically? You should restrict it to the 
classes you know about, so you can find their meta objects.
-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130122/1581cfd6/attachment.sig>


More information about the Interest mailing list