diff options
author | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2011-12-30 14:18:28 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-01-02 13:33:11 +0100 |
commit | 5a3b08e994b9120a370123d1a8d96f28216eaeca (patch) | |
tree | 762c8bdf23a72a03dee01658eca4fb2147ed03d4 | |
parent | 8cb0ef0793c292d546acabc813d8af6a026dc7bf (diff) |
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>
-rw-r--r-- | src/corelib/global/qglobal.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index e75118fc3a..785ee4a49a 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -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); |