Unsolved Misleading header names
-
I'm not sure that's even a problem but I have to ask anyway.
Qt provides extensionless header files like Qlist or QtCore. Interesting fact is that a lot of them contain just one line:
QObject is "#include "qobject.h"
QApplication is "#include "qapplication.h"
QTimer is "#include "qtimer.h"
and so on. I don't know why this is done like that but no matter.My question is: why file QMetaObject does not include qmetaobject.h but includes qobjectdefs.h?
I spent quite some time trying to figure out why I have only forward declaration of 'class QMetaEnum'. -
Hi
In doc, it lists the header to use for a an object
like
Header: #include <QMetaObject>So using "internal" names like qapplication.h might lead to surprises like u seen with meta system.
I guess with such big framework, some inconsistencies will exists :)
-
@Amomum said:
I don't know why this is done like that but no matter.
Because it's easier for users to #include the class names. No need to remember the separate header filenames.
My question is: why file QMetaObject does not include qmetaobject.h but includes qobjectdefs.h?
I spent quite some time trying to figure out why I have only forward declaration of 'class QMetaEnum'.That looks like a bug. Could you please submit a report to https://bugreports.qt.io/ ?
-
@JKSH sure. I have submitted here https://bugreports.qt.io/browse/QTBUG-50643
-
@JKSH said:
That looks like a bug.
I beg to differ.
@Amomum, if you take a peek at the documentation of
QMetaObject
you'll notice thatQMetaEnum
is only used as a return type, so by using only the forward declaration Qt developers ensured minimal number of includes. If you need to useQMetaEnum
just include that header in your code, no need to burden the compiler with headers that are not needed for compilation.Kind regards.