[Interest] Qt namespaces and Q_MOC_RUN trick (aka: the mistery of qnamespace.h)

Thiago Macieira thiago.macieira at intel.com
Thu Jan 10 19:11:39 CET 2013


On quinta-feira, 10 de janeiro de 2013 17.21.31, Sandro Andrade wrote:
> Hi there,
> 
> I need to have some enums defined in a namespace like the ones we can
> find at qtbase:src/corelib/global/qnamespace.h.
> 
> I've tried the same approach in my project but moc complains with the
> following: "Class contains Q_OBJECT macro but does not inherit from
> QObject"
> 
> I know we can use Q_GADGET instead of Q_OBJECT but I'm still getting
> some build errors.
> 
> The real point is: is there some 'magic' qmake flag or something else
> used in qnamespace.h for having
> that working properly ?

Yes, there's magic hardcoded in moc and in QMetaObject::property.

-- 
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/20130110/42bc566f/attachment.sig>


More information about the Interest mailing list