Commit 9ba1bb61 authored by Friedemann Kleint's avatar Friedemann Kleint
Browse files

dumpcpp: Speculative fix for methods taking array type parameters.


QMetaMethod::methodSignature() produces for an invokable slot with
array type parameters (void foo(const char p1[10],int p2)):
foo(const char[10],int)
Split off the array specification and append it to the parameter name.

Task-number: QTBUG-46177
Change-Id: I58670570357472f6f5b7fcf0e841d3b7cb4189c8
Reviewed-by: default avatarJoerg Bornemann <joerg.bornemann@theqtcompany.com>
Showing with 7 additions and 0 deletions
......@@ -432,9 +432,16 @@ void generateClassDecl(QTextStream &out, const QString &controlID, const QMetaOb
if (!parameterType.contains("::") && namespaceForType.contains(parameterType))
parameterType.prepend(namespaceForType.value(parameterType) + "::");
QByteArray arraySpec; // transform array method signature "foo(int[4])" ->"foo(int p[4])"
const int arrayPos = parameterType.lastIndexOf('[');
if (arrayPos != -1) {
arraySpec = parameterType.right(parameterType.size() - arrayPos);
parameterType.truncate(arrayPos);
}
slotNamedSignature += constRefify(parameterType);
slotNamedSignature += ' ';
slotNamedSignature += parameterSplit.at(i);
slotNamedSignature += arraySpec;
if (defaultArguments >= signatureSplit.count() - i) {
slotNamedSignature += " = ";
slotNamedSignature += parameterType + "()";
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment