diff options
Diffstat (limited to 'src/tools/moc/moc.cpp')
-rw-r--r-- | src/tools/moc/moc.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp index a6a0ba1..a1738a5 100644 --- a/src/tools/moc/moc.cpp +++ b/src/tools/moc/moc.cpp @@ -752,14 +752,14 @@ void Moc::generate(FILE *out) if (!noInclude) { - if (includePath.size() && includePath.right(1) != "/") - includePath += "/"; + if (includePath.size() && !includePath.endsWith('/')) + includePath += '/'; for (int i = 0; i < includeFiles.size(); ++i) { QByteArray inc = includeFiles.at(i); if (inc[0] != '<' && inc[0] != '"') { if (includePath.size() && includePath != "./") inc.prepend(includePath); - inc = "\"" + inc + "\""; + inc = '\"' + inc + '\"'; } fprintf(out, "#include %s\n", inc.constData()); } @@ -767,6 +767,9 @@ void Moc::generate(FILE *out) if (classList.size() && classList.first().classname == "Qt") fprintf(out, "#include <QtCore/qobject.h>\n"); + if (mustIncludeQMetaTypeH) + fprintf(out, "#include <QtCore/qmetatype.h>\n"); + fprintf(out, "#if !defined(Q_MOC_OUTPUT_REVISION)\n" "#error \"The header file '%s' doesn't include <QObject>.\"\n", (const char *)fn); fprintf(out, "#elif Q_MOC_OUTPUT_REVISION != %d\n", mocOutputRevision); @@ -898,6 +901,9 @@ void Moc::parseProperty(ClassDef *def) type = "qlonglong"; else if (type == "ULongLong") type = "qulonglong"; + else if (type == "qreal") + mustIncludeQMetaTypeH = true; + propDef.type = type; next(); @@ -959,7 +965,7 @@ void Moc::parseProperty(ClassDef *def) msg += " has no READ accessor function. The property will be invalid."; warning(msg.constData()); } - if(!propDef.notify.isEmpty()) + if(!propDef.notify.isEmpty()) def->notifyableProperties++; def->propertyList += propDef; |