[Interest] Q_ENUMS with foreign enum ?

Nurmi J-P jpnurmi at digia.com
Mon Jul 14 11:29:52 CEST 2014


On 14 Jul 2014, at 11:11, Rutledge Shawn <Shawn.Rutledge at digia.com> wrote:

> 
> On 12 Jul 2014, at 10:03 AM, Martin Koller wrote:
> 
>> Hi,
>> 
>> is there any possibility to use an enum in the Q_ENUMS macro when the enum is not
>> defined in a QObject derived class ?
>> (Specifically I'm trying to do that with QSslError::SslError)
> 
> The Qt namespace has a lot of enums like that.  The trick there is to get moc to pretend that the namespace is actually a class.
> 
> src/corelib/global/qnamespace.h
> 
> (But the fact that it is not a class is perhaps only historical… does anybody know more?)


Hi,

Q_GADGET macro allows Q_ENUMS for non-QObject classes, but it would be cool to have a macro (such as Q_NAMESPACE?) that would make the meta object available for plain namespaces.

--
J-P Nurmi




More information about the Interest mailing list