diff options
author | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2014-11-14 21:53:20 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2014-12-23 14:51:17 +0100 |
commit | d641008d04475bfb1c1996e408b1408618845b6f (patch) | |
tree | 537abe3f4f6751c3a41f460546782c483a9bdc8e /src/qml/jsruntime/qv4qobjectwrapper_p.h | |
parent | c9adc7661a7eef4f2eefb51f02c0393be2ec3898 (diff) |
Prepare method invocation in QObject bindings for gadget support
In order to support calling invokable methods in gadgets from JavaScript, the
wrapper code needs to be able to operate on gadgets and not only QObject
pointers. The minimal abstraction for that - QQmlGadgetOrObject - is passed
through the relevant invocation methods in the wrapper for that.
Change-Id: I94f939c942241f49dce4d32d05bf24822b2d331b
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4qobjectwrapper_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4qobjectwrapper_p.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/qml/jsruntime/qv4qobjectwrapper_p.h b/src/qml/jsruntime/qv4qobjectwrapper_p.h index 5796241a8a..f0dd440ce3 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper_p.h +++ b/src/qml/jsruntime/qv4qobjectwrapper_p.h @@ -75,10 +75,15 @@ struct QObjectWrapper : Object { }; struct QObjectMethod : FunctionObject { - QObjectMethod(QV4::ExecutionContext *scope, QObject *object, int index, const ValueRef qmlGlobal); + QObjectMethod(QV4::ExecutionContext *scope); QPointer<QObject> object; + QQmlRefPointer<QQmlPropertyCache> propertyCache; int index; Value qmlGlobal; + + Value valueTypeWrapper; + + const QMetaObject *metaObject(); }; struct QmlSignalHandler : Object { @@ -133,6 +138,8 @@ private: static ReturnedValue method_disconnect(CallContext *ctx); }; +struct QQmlValueTypeWrapper; + struct Q_QML_EXPORT QObjectMethod : public QV4::FunctionObject { V4_OBJECT2(QObjectMethod, QV4::FunctionObject) @@ -141,6 +148,7 @@ struct Q_QML_EXPORT QObjectMethod : public QV4::FunctionObject enum { DestroyMethod = -1, ToStringMethod = -2 }; static ReturnedValue create(QV4::ExecutionContext *scope, QObject *object, int index, const ValueRef qmlGlobal = Primitive::undefinedValue()); + static ReturnedValue create(QV4::ExecutionContext *scope, QQmlValueTypeWrapper *valueType, int index, const ValueRef qmlGlobal = Primitive::undefinedValue()); int methodIndex() const { return d()->index; } QObject *object() const { return d()->object.data(); } |