[Development] From whence cometh Q_NAMESPACE?

Giuseppe D'Angelo giuseppe.dangelo at kdab.com
Tue Jun 11 18:30:03 CEST 2019


Il 11/06/19 17:28, Matthew Woehlke ha scritto:
> A coworker just pointed out something interesting... the documentation
> of Q_NAMESPACE is in qobject.cpp, which causes it to be documented under
> the documentation for QObject.

Technically, it's the \relates command that puts it in the QObject's 
docs, not the fact that it appears in qobject.cpp.

> 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?

Well, also Q_OBJECT itself, Q_SIGNALS/Q_SLOTS, etc. appear in 
qobjectdefs.h, yet obviously the right place for documented them is 
QObject. So I think the other macros just followed suit. Maybe it's 
possible to specify that macro for multiple targets, but is it worth it?

Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4329 bytes
Desc: Firma crittografica S/MIME
URL: <http://lists.qt-project.org/pipermail/development/attachments/20190611/8aece764/attachment.bin>

More information about the Development mailing list