diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-05-19 10:47:17 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-05-19 09:50:32 +0000 |
commit | 9ba1bb61f17f99040ef4083e409c5d4e0abdcd4a (patch) | |
tree | 0819d31215f980c082894bf9e7aec9310cefa79f /tools | |
parent | 0cef1cc32f372d19458b000ba4e21b90eca588ba (diff) | |
download | qtactiveqt-9ba1bb61f17f99040ef4083e409c5d4e0abdcd4a.tar.gz |
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: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/dumpcpp/main.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/dumpcpp/main.cpp b/tools/dumpcpp/main.cpp index 4ec7697..691e723 100644 --- a/tools/dumpcpp/main.cpp +++ b/tools/dumpcpp/main.cpp @@ -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 + "()"; |