diff options
author | Milian Wolff <milian.wolff@kdab.com> | 2014-10-16 13:37:22 +0200 |
---|---|---|
committer | Milian Wolff <milian.wolff@kdab.com> | 2014-12-02 14:16:55 +0100 |
commit | 81dac6e848da8e8a071a2069862590889a287067 (patch) | |
tree | b8bbca884fd5e04755f6feaa7310e2d02c5fac34 /src/webchannel/qmetaobjectpublisher_p.h | |
parent | 86d77a900852691267f556fbde98406a12ee4310 (diff) | |
download | qtwebchannel-81dac6e848da8e8a071a2069862590889a287067.tar.gz |
Make objects inside properties accessible.
Similar to the support for factory-methods, we must wrap objects in
properties to make them accessible to clients. This patch adds the
required code for that. Besides support for simple properties that
reference an object, this patch also adds support for list properties
that contain objects.
The client-side unwrap of properties is delayed until all objects
are initialized, as a property might reference another registered
object.
Change-Id: I9fb90a8eab4c66d2f4231fdb482e0d97d128df3e
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Diffstat (limited to 'src/webchannel/qmetaobjectpublisher_p.h')
-rw-r--r-- | src/webchannel/qmetaobjectpublisher_p.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/webchannel/qmetaobjectpublisher_p.h b/src/webchannel/qmetaobjectpublisher_p.h index a7cdda7..05f33bd 100644 --- a/src/webchannel/qmetaobjectpublisher_p.h +++ b/src/webchannel/qmetaobjectpublisher_p.h @@ -94,7 +94,7 @@ public: /** * Serialize the QMetaObject of @p object and return it in JSON form. */ - QJsonObject classInfoForObject(const QObject *object) const; + QJsonObject classInfoForObject(const QObject *object); /** * Set the client to idle or busy, based on the value of @p isIdle. @@ -154,12 +154,17 @@ public: * return the objects class information. * * All other input types are returned as-is. - * - * TODO: support wrapping of initially-registered objects */ QJsonValue wrapResult(const QVariant &result); /** + * Convert a list of variant values for consumption by the client. + * + * This properly handles QML values and also wraps the result if required. + */ + QJsonArray wrapList(const QVariantList &list); + + /** * Invoke delete later on @p object. */ void deleteWrappedObject(QObject *object) const; |