diff options
Diffstat (limited to 'src/tools/moc/generator.cpp')
-rw-r--r-- | src/tools/moc/generator.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp index ae8a76e..e4ad068 100644 --- a/src/tools/moc/generator.cpp +++ b/src/tools/moc/generator.cpp @@ -109,6 +109,14 @@ bool isVariantType(const char* type) return qvariant_nameToType(type) != 0; } +/*! + Returns true if the type is qreal. +*/ +static bool isQRealType(const char *type) +{ + return strcmp(type, "qreal") == 0; +} + Generator::Generator(ClassDef *classDef, const QList<QByteArray> &metaTypes, FILE *outfile) : out(outfile), cdef(classDef), metaTypes(metaTypes) { @@ -545,7 +553,7 @@ void Generator::generateProperties() uint flags = Invalid; if (!isVariantType(p.type)) { flags |= EnumOrFlag; - } else { + } else if (!isQRealType(p.type)) { flags |= qvariant_nameToType(p.type) << 24; } if (!p.read.isEmpty()) @@ -589,10 +597,12 @@ void Generator::generateProperties() if (p.notifyId != -1) flags |= Notify; - fprintf(out, " %4d, %4d, 0x%.8x,\n", - strreg(p.name), - strreg(p.type), - flags); + fprintf(out, " %4d, %4d, ", + strreg(p.name), + strreg(p.type)); + if (!(flags >> 24) && isQRealType(p.type)) + fprintf(out, "(QMetaType::QReal << 24) | "); + fprintf(out, "0x%.8x,\n", flags); } if(cdef->notifyableProperties) { @@ -1161,8 +1171,8 @@ void Generator::_generateFunctions(QList<FunctionDef> &list, int type) for (int j = 0; j < f.arguments.count(); ++j) { const ArgumentDef &a = f.arguments.at(j); if (j) { - sig += ","; - arguments += ","; + sig += ','; + arguments += ','; } sig += a.normalizedType; arguments += a.name; |