[Development] From whence cometh Q_NAMESPACE?
Matthew Woehlke
mwoehlke.floss at gmail.com
Tue Jun 11 19:24:47 CEST 2019
On 11/06/2019 12.30, Giuseppe D'Angelo via Development wrote:
> Il 11/06/19 17:28, Matthew Woehlke ha scritto:
>> [...] would it make sense to move the documentation [of
>> Q_NAMESPACE, Q_ENUM, etc.] 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.
Agreed in both respects. (Yes, it's correct. Yes, it is obviously so.)
> 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?
(For context: https://github.com/Kitware/seal-tk/pull/28.)
As it stands, the doc "implies" that `#include <QObject>` is required to
use Q_NAMESPACE and friends. But this is overkill, and in (current)
reality, <QMetaObject> is sufficient.
So, my questions are:
1. Is it really Qt's intent that using Q_NAMESPACE, etc. requires
including <QObject>?
2. If not, is it worth tweaking the documentation to make it clearer
that <QMetaObject> is sufficient?
(I don't see why we would need to "specify that macro for multiple
targets"... just "move" it to QMetaObject. It should be clear that
<QObject> includes <QMetaObject>.)
--
Matthew
More information about the Development
mailing list