[Development] From whence cometh Q_NAMESPACE?

Edward Welbourne edward.welbourne at qt.io
Tue Jun 11 19:38:28 CEST 2019

Matthew Woehlke (11 June 2019 17:28)
> A coworker just pointed out something interesting... the documentation
> of Q_NAMESPACE is in qobject.cpp,

which is also the .cpp file which pulls in moc_qnamespace.cpp (at its end).
No, I don't know why, I just tripped over it recently !

> which causes it to be documented under
> the documentation for QObject. However, the *definition* comes from
> qobjectdefs.h, which is roughly QMetaObject, and indeed it seems like
> one should not need all of QObject to use Q_NAMESPACE. Q_ENUM and
> Q_ENUM_NS are in the same boat... In fact, so is Q_GADGET and everything
> that can be used with Q_GADGET.
> Is this intended? Or would it make sense to move the documentation to
> QMetaObject?

It does sound bizarre, but I've no idea why it's like that.  Perhaps
someone with access to the pre-history in our version control can work
it out.


More information about the Development mailing list