Do not unconditionally define QT_BEGIN_MOC_NAMESPACE
Qt5 modules are supposed to be in a namespace, but if the namespace definition is hidden in a macro, then moc doesn't know about it and generates invalid moc_xx.cpp that cannot be compiled due to usage of classes outside of their namespaces - e.g. in qtjsondb we have QtAddOn::JsonDb::Foo class, but the moc_foo.cpp expects to find that class in the global namespace instead. Fixed it in QtJsonDb to define QT_BEGIN_MOC_NAMESPACE="QT_USE_NAMESPACE QT_ADDON_JSONDB_USE_NAMESPACE", however we need to ensure qglobal.h doesn't re-define that macro back. Change-Id: Ic8407f50c11d2d787167ad2f92457aa3ec126d45 Reviewed-by: Andy Shaw <andy.shaw@digia.com> Reviewed-by: Richard J. Moore <rich@kde.org> Reviewed-by: Toby Tomkins <toby.tomkins@nokia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
This commit is contained in:
parent
8cb0ef0793
commit
5a3b08e994
@ -76,8 +76,12 @@
|
||||
# define QT_END_NAMESPACE
|
||||
# define QT_BEGIN_INCLUDE_NAMESPACE
|
||||
# define QT_END_INCLUDE_NAMESPACE
|
||||
#ifndef QT_BEGIN_MOC_NAMESPACE
|
||||
# define QT_BEGIN_MOC_NAMESPACE
|
||||
#endif
|
||||
#ifndef QT_END_MOC_NAMESPACE
|
||||
# define QT_END_MOC_NAMESPACE
|
||||
#endif
|
||||
# define QT_FORWARD_DECLARE_CLASS(name) class name;
|
||||
# define QT_FORWARD_DECLARE_STRUCT(name) struct name;
|
||||
# define QT_MANGLE_NAMESPACE(name) name
|
||||
@ -90,8 +94,12 @@
|
||||
# define QT_END_NAMESPACE }
|
||||
# define QT_BEGIN_INCLUDE_NAMESPACE }
|
||||
# define QT_END_INCLUDE_NAMESPACE namespace QT_NAMESPACE {
|
||||
#ifndef QT_BEGIN_MOC_NAMESPACE
|
||||
# define QT_BEGIN_MOC_NAMESPACE QT_USE_NAMESPACE
|
||||
#endif
|
||||
#ifndef QT_END_MOC_NAMESPACE
|
||||
# define QT_END_MOC_NAMESPACE
|
||||
#endif
|
||||
# define QT_FORWARD_DECLARE_CLASS(name) \
|
||||
QT_BEGIN_NAMESPACE class name; QT_END_NAMESPACE \
|
||||
using QT_PREPEND_NAMESPACE(name);
|
||||
|
Loading…
Reference in New Issue
Block a user