moc generated code should compile with QT_NO_KEYWORDS

Don't use the 'emit' keyword in the moc generated code for properties
with MEMBER

Task-number: QTBUG-33094
Change-Id: I5a0950e9c7a0dee347a6a6c79098e3e7d4776014
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
bb10
Olivier Goffart 2013-08-21 09:32:16 +02:00 committed by The Qt Project
parent 2bd40c53ef
commit 8a96679493
2 changed files with 7 additions and 2 deletions

View File

@ -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");

View File

@ -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"