diff options
author | Lars Knoll <lars.knoll@qt.io> | 2019-05-16 09:28:55 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2019-10-07 20:40:51 +0200 |
commit | 4c571032f8763c55526a3d9f6bcb8e1336766bd9 (patch) | |
tree | 39d4d604b71b48aeb8e1bde08c27f0ded0ec9781 /src/tools/moc | |
parent | 1acc4448c24784dbf824c78acb862240f938d47a (diff) |
Add support for slots to receive the raw void ** arguments array
This is currently being used by dbus und our state machine framework,
and supported by hand editing moc generated code.
Get rid of that hack, and instead add support to moc to forward
the raw arguments array to the slot.
Change-Id: I0e36626f91eb01041464e6d931dc1d4660de91d2
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/tools/moc')
-rw-r--r-- | src/tools/moc/generator.cpp | 28 | ||||
-rw-r--r-- | src/tools/moc/moc.cpp | 5 | ||||
-rw-r--r-- | src/tools/moc/moc.h | 1 |
3 files changed, 22 insertions, 12 deletions
diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp index 6a74e739e6..ace3a4c9f3 100644 --- a/src/tools/moc/generator.cpp +++ b/src/tools/moc/generator.cpp @@ -1217,18 +1217,22 @@ void Generator::generateStaticMetacall() fprintf(out, "%s(", f.name.constData()); int offset = 1; - int argsCount = f.arguments.count(); - for (int j = 0; j < argsCount; ++j) { - const ArgumentDef &a = f.arguments.at(j); - if (j) - fprintf(out, ","); - fprintf(out, "(*reinterpret_cast< %s>(_a[%d]))",a.typeNameForCast.constData(), offset++); - isUsed_a = true; - } - if (f.isPrivateSignal) { - if (argsCount > 0) - fprintf(out, ", "); - fprintf(out, "%s", "QPrivateSignal()"); + if (f.isRawSlot) { + fprintf(out, "QMethodRawArguments{ _a }"); + } else { + int argsCount = f.arguments.count(); + for (int j = 0; j < argsCount; ++j) { + const ArgumentDef &a = f.arguments.at(j); + if (j) + fprintf(out, ","); + fprintf(out, "(*reinterpret_cast< %s>(_a[%d]))",a.typeNameForCast.constData(), offset++); + isUsed_a = true; + } + if (f.isPrivateSignal) { + if (argsCount > 0) + fprintf(out, ", "); + fprintf(out, "%s", "QPrivateSignal()"); + } } fprintf(out, ");"); if (f.normalizedType != "void") { diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp index 8cc605fd8a..b98198d1d5 100644 --- a/src/tools/moc/moc.cpp +++ b/src/tools/moc/moc.cpp @@ -328,6 +328,11 @@ void Moc::parseFunctionArguments(FunctionDef *def) def->arguments.removeLast(); def->isPrivateSignal = true; } + if (def->arguments.size() == 1 + && def->arguments.constLast().normalizedType == "QMethodRawArguments") { + def->arguments.removeLast(); + def->isRawSlot = true; + } } bool Moc::testFunctionAttribute(FunctionDef *def) diff --git a/src/tools/moc/moc.h b/src/tools/moc/moc.h index 687ea2552f..6785b7f9e8 100644 --- a/src/tools/moc/moc.h +++ b/src/tools/moc/moc.h @@ -115,6 +115,7 @@ struct FunctionDef bool isConstructor = false; bool isDestructor = false; bool isAbstract = false; + bool isRawSlot = false; QJsonObject toJson() const; static void accessToJson(QJsonObject *obj, Access acs); |