I already do this by maintaining a big ugly if/else block to test for all of my custom enumeration types. I actually just realized metaObjectForType is available and I tried using it. The code looks much cleaner, but then it doesn't work for the few enums that are not defined in QObjects.
On Tue, Jan 22, 2013 at 7:11 PM, Thiago Macieira <thiago.macie...@intel.com>wrote: > 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 > > _______________________________________________ > Interest mailing list > Interest@qt-project.org > http://lists.qt-project.org/mailman/listinfo/interest > > -- Shady Zayat
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest