diff options
Diffstat (limited to 'Godeps/_workspace/src/github.com/obscuren/qml/cpp/connector.cpp')
-rw-r--r-- | Godeps/_workspace/src/github.com/obscuren/qml/cpp/connector.cpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/Godeps/_workspace/src/github.com/obscuren/qml/cpp/connector.cpp b/Godeps/_workspace/src/github.com/obscuren/qml/cpp/connector.cpp new file mode 100644 index 000000000..6005bfc62 --- /dev/null +++ b/Godeps/_workspace/src/github.com/obscuren/qml/cpp/connector.cpp @@ -0,0 +1,46 @@ +#include <QObject> + +#include "connector.h" +#include "capi.h" + +Connector::~Connector() +{ + hookSignalDisconnect(func); +} + +void Connector::invoke() +{ + panicf("should never get called"); +} + +int Connector::qt_metacall(QMetaObject::Call c, int idx, void **a) +{ + if (c == QMetaObject::InvokeMetaMethod && idx == metaObject()->methodOffset()) { + DataValue args[MaxParams]; + QObject *plain = NULL; + for (int i = 0; i < argsLen; i++) { + int paramType = method.parameterType(i); + if (paramType == 0 && a[1 + i] != NULL) { + const char *typeName = method.parameterTypes()[i].constData(); + void *addr = a[1 + i]; + if (typeName[strlen(typeName)-1] == '*') { + addr = *(void **)addr; + } + plain = new PlainObject(typeName, addr, plain); + QVariant var = QVariant::fromValue((QObject *)plain); + packDataValue(&var, &args[i]); + } else { + QVariant var(method.parameterType(i), a[1 + i]); + packDataValue(&var, &args[i]); + } + } + hookSignalCall(engine, func, args); + if (plain != NULL) { + delete plain; + } + return -1; + } + return standard_qt_metacall(c, idx, a); +} + +// vim:ts=4:sw=4:et |