diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2022-05-17 12:24:30 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2022-05-18 00:07:34 +0200 |
commit | cf3843a2684c434a4800a7c11071e77f45817b70 (patch) | |
tree | 0e97a7da8f17999e77edaa607a1860b91ea0ae4b /src/tools | |
parent | bb2f4d08d9d138e4f70d6d6db46e24e34500becc (diff) |
moc: Add line breaks to the qt_incomplete_metaTypeArray<>
The code is hard to read due to the long line generated.
Task-number: QTBUG-100145
Change-Id: I1d1a7a547db71cca1e710d39df809f079fc2dafe
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/moc/generator.cpp | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp index 1d3ba97a3b..3d633debd2 100644 --- a/src/tools/moc/generator.cpp +++ b/src/tools/moc/generator.cpp @@ -539,7 +539,7 @@ void Generator::generateCode() bool needsComma = false; const bool requireCompleteness = requireCompleteTypes || cdef->requireCompleteMethodTypes; if (!requireCompleteness) { - fprintf(out, "qt_incomplete_metaTypeArray<qt_meta_stringdata_%s_t\n", qualifiedClassNameIdentifier.constData()); + fprintf(out, "qt_incomplete_metaTypeArray<qt_meta_stringdata_%s_t", qualifiedClassNameIdentifier.constData()); needsComma = true; } else { fprintf(out, "qt_metaTypeArray<\n"); @@ -547,18 +547,22 @@ void Generator::generateCode() // metatypes for properties for (int i = 0; i < cdef->propertyList.count(); ++i) { const PropertyDef &p = cdef->propertyList.at(i); + if (needsComma) + fputs(",\n ", out); if (requireCompleteness) - fprintf(out, "%s%s", needsComma ? ", " : "", p.type.data()); + fputs(p.type.data(), out); else - fprintf(out, "%sQtPrivate::TypeAndForceComplete<%s, std::true_type>", needsComma ? ", " : "", p.type.data()); + fprintf(out, "QtPrivate::TypeAndForceComplete<%s, std::true_type>", p.type.data()); needsComma = true; } // type name for the Q_OJBECT/GADGET itself, void for namespaces auto ownType = !cdef->hasQNamespace ? cdef->classname.data() : "void"; + if (needsComma) + fputs(",\n ", out); if (requireCompleteness) - fprintf(out, "%s%s", needsComma ? ", " : "", ownType); + fputs(ownType, out); else - fprintf(out, "%sQtPrivate::TypeAndForceComplete<%s, std::true_type>", needsComma ? ", " : "", ownType); + fprintf(out, "QtPrivate::TypeAndForceComplete<%s, std::true_type>", ownType); // metatypes for all exposed methods // no need to check for needsComma any longer, as we always need one due to the classname being present @@ -567,14 +571,14 @@ void Generator::generateCode() for (int i = 0; i< methodContainer.count(); ++i) { const FunctionDef& fdef = methodContainer.at(i); if (requireCompleteness) - fprintf(out, ", %s", fdef.type.name.data()); + fprintf(out, ",\n %s", fdef.type.name.data()); else - fprintf(out, ", QtPrivate::TypeAndForceComplete<%s, std::false_type>", fdef.type.name.data()); + fprintf(out, ",\n QtPrivate::TypeAndForceComplete<%s, std::false_type>", fdef.type.name.data()); for (const auto &argument: fdef.arguments) { if (requireCompleteness) fprintf(out, ", %s", argument.type.name.data()); else - fprintf(out, ", QtPrivate::TypeAndForceComplete<%s, std::false_type>", argument.type.name.data()); + fprintf(out, ",\n QtPrivate::TypeAndForceComplete<%s, std::false_type>", argument.type.name.data()); } } fprintf(out, "\n"); @@ -583,12 +587,11 @@ void Generator::generateCode() const FunctionDef& fdef = cdef->constructorList.at(i); for (const auto &argument: fdef.arguments) { if (requireCompleteness) - fprintf(out, ", %s", argument.type.name.data()); + fprintf(out, ",\n %s", argument.type.name.data()); else - fprintf(out, ", QtPrivate::TypeAndForceComplete<%s, std::false_type>", argument.type.name.data()); + fprintf(out, ",\n QtPrivate::TypeAndForceComplete<%s, std::false_type>", argument.type.name.data()); } } - fprintf(out, "\n"); fprintf(out, ">,\n"); fprintf(out, " nullptr\n} };\n\n"); |