diff options
Diffstat (limited to 'src/tools/moc')
-rw-r--r-- | src/tools/moc/generator.cpp | 6 | ||||
-rw-r--r-- | src/tools/moc/moc.cpp | 7 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp index a67ea05956..c63e80f90f 100644 --- a/src/tools/moc/generator.cpp +++ b/src/tools/moc/generator.cpp @@ -266,10 +266,12 @@ void Generator::generateCode() { int idx = 0; for (int i = 0; i < strings.size(); ++i) { - if (i) - fprintf(out, ",\n"); const QByteArray &str = strings.at(i); fprintf(out, "QT_MOC_LITERAL(%d, %d, %d)", i, idx, str.length()); + if (i != strings.size() - 1) + fputc(',', out); + const QByteArray comment = str.length() > 32 ? str.left(29) + "..." : str; + fprintf(out, " // \"%s\"\n", comment.constData()); idx += str.length() + 1; for (int j = 0; j < str.length(); ++j) { if (str.at(j) == '\\') { diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp index f5700899fa..91aa97a443 100644 --- a/src/tools/moc/moc.cpp +++ b/src/tools/moc/moc.cpp @@ -1552,10 +1552,17 @@ void Moc::checkProperties(ClassDef *cdef) // specify get function, for compatibiliy we accept functions // returning pointers, or const char * for QByteArray. // + QSet<QByteArray> definedProperties; for (int i = 0; i < cdef->propertyList.count(); ++i) { PropertyDef &p = cdef->propertyList[i]; if (p.read.isEmpty() && p.member.isEmpty()) continue; + if (definedProperties.contains(p.name)) { + QByteArray msg = "The property '" + p.name + "' is defined multiple times in class " + cdef->classname + "."; + warning(msg.constData()); + } + definedProperties.insert(p.name); + for (int j = 0; j < cdef->publicList.count(); ++j) { const FunctionDef &f = cdef->publicList.at(j); if (f.name != p.read) |