Fixed arguments offset

Methods have always the return value at pos 0 and arguments in pos >= 1. This is not true for WriteProperty calls. Infact the property value is at pos 0.
This commit is contained in:
Filippo Cucchetto 2016-01-24 23:21:03 +01:00
parent 562fcc71a7
commit cd0c08fb50
2 changed files with 5 additions and 5 deletions

View File

@ -37,7 +37,7 @@ public:
int qt_metacall(QMetaObject::Call, int, void **) override;
private:
bool executeSlot(const QMetaMethod& method, void** args);
bool executeSlot(const QMetaMethod& method, void** args, int argumentsOffset = 1);
bool executeSlot(int index, void** args);
bool readProperty(int index, void** args);
bool writeProperty(int index, void** args);

View File

@ -70,7 +70,7 @@ bool DosQObjectImpl::executeSlot(int index, void **args)
executeSlot(method, args);
}
bool DosQObjectImpl::executeSlot(const QMetaMethod &method, void **args)
bool DosQObjectImpl::executeSlot(const QMetaMethod &method, void **args, int argumentsOffset)
{
Q_ASSERT(method.isValid());
@ -78,8 +78,8 @@ bool DosQObjectImpl::executeSlot(const QMetaMethod &method, void **args)
std::vector<QVariant> arguments;
arguments.reserve(method.parameterCount());
for (int i = 0; i < method.parameterCount(); ++i) {
QVariant argument(method.parameterType(i), args[i + 1]);
for (int i = 0, j = argumentsOffset; i < method.parameterCount(); ++i, ++j) {
QVariant argument(method.parameterType(i), args[j]);
arguments.emplace_back(std::move(argument));
}
@ -117,7 +117,7 @@ bool DosQObjectImpl::writeProperty(int index, void **args)
qDebug() << "C++: writeProperty: invalid write method for property " << property.name();
return false;
}
return executeSlot(method, args);
return executeSlot(method, args, 0);
}
}