summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/tools/moc/generator.cpp4
-rw-r--r--tests/auto/tools/moc/tst_moc.cpp5
2 files changed, 7 insertions, 2 deletions
diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp
index 3302d23ad4..50da6d2e54 100644
--- a/src/tools/moc/generator.cpp
+++ b/src/tools/moc/generator.cpp
@@ -984,9 +984,9 @@ void Generator::generateMetacall()
if (!p.notify.isEmpty() && p.notifyId != -1) {
const FunctionDef &f = cdef->signalList.at(p.notifyId);
if (f.arguments.size() == 0)
- fprintf(out, " emit %s();\n", p.notify.constData());
+ fprintf(out, " Q_EMIT %s();\n", p.notify.constData());
else if (f.arguments.size() == 1 && f.arguments.at(0).normalizedType == p.type)
- fprintf(out, " emit %s(%s%s);\n",
+ fprintf(out, " Q_EMIT %s(%s%s);\n",
p.notify.constData(), prefix.constData(), p.member.constData());
}
fprintf(out, " }\n");
diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp
index 0728533c6b..231007af1a 100644
--- a/tests/auto/tools/moc/tst_moc.cpp
+++ b/tests/auto/tools/moc/tst_moc.cpp
@@ -3033,5 +3033,10 @@ void tst_Moc::QTBUG32933_relatedObjectsDontIncludeItself()
QTEST_MAIN(tst_Moc)
+// the generated code must compile with QT_NO_KEYWORDS
+#undef signals
+#undef slots
+#undef emit
+
#include "tst_moc.moc"