summaryrefslogtreecommitdiffstats
path: root/src/tools/moc/generator.cpp
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2019-12-04 19:36:33 +0100
committerOlivier Goffart (Woboq GmbH) <ogoffart@woboq.com>2019-12-06 20:29:15 +0000
commitcedf0207d1ebd931fe155ca04abbf3cb0702854a (patch)
tree18e05bd7f3ed9b448b256c1c4337ced4b4749465 /src/tools/moc/generator.cpp
parentb0498b1864829a314b70c4204bb47529ab3654b2 (diff)
Use Q_NAMESPACE for the Qt namespace, and remove the old moc hack to support it
Since I can't #include qobjectdefs from qnamespace because of circular dependency, move the Qt macro in the qtmetamacros.h header. Deprecate QObject::staticQtMetaObject since now one can just use Qt::staticMetaObject Change-Id: I11982aa17c2afa2067486b113f8052672f3695eb Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/tools/moc/generator.cpp')
-rw-r--r--src/tools/moc/generator.cpp11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp
index ace3a4c9f3..a9bf934e79 100644
--- a/src/tools/moc/generator.cpp
+++ b/src/tools/moc/generator.cpp
@@ -194,7 +194,6 @@ static bool qualifiedNameEquals(const QByteArray &qualifiedName, const QByteArra
void Generator::generateCode()
{
- bool isQt = (cdef->classname == "Qt");
bool isQObject = (cdef->classname == "QObject");
bool isConstructible = !cdef->constructorList.isEmpty();
@@ -452,7 +451,7 @@ void Generator::generateCode()
//
// Generate internal qt_static_metacall() function
//
- const bool hasStaticMetaCall = !isQt &&
+ const bool hasStaticMetaCall =
(cdef->hasQObject || !cdef->methodList.isEmpty()
|| !cdef->propertyList.isEmpty() || !cdef->constructorList.isEmpty());
if (hasStaticMetaCall)
@@ -534,10 +533,7 @@ void Generator::generateCode()
//
// Finally create and initialize the static meta object
//
- if (isQt)
- fprintf(out, "QT_INIT_METAOBJECT const QMetaObject QObject::staticQtMetaObject = { {\n");
- else
- fprintf(out, "QT_INIT_METAOBJECT const QMetaObject %s::staticMetaObject = { {\n", cdef->qualified.constData());
+ fprintf(out, "QT_INIT_METAOBJECT const QMetaObject %s::staticMetaObject = { {\n", cdef->qualified.constData());
if (isQObject)
fprintf(out, " nullptr,\n");
@@ -559,9 +555,6 @@ void Generator::generateCode()
fprintf(out, " qt_meta_extradata_%s,\n", qualifiedClassNameIdentifier.constData());
fprintf(out, " nullptr\n} };\n\n");
- if(isQt)
- return;
-
if (!cdef->hasQObject)
return;