Details
-
Task
-
Resolution: Done
-
Not Evaluated
-
None
-
None
-
I used qtwebchannel from qts github repository in dev branch
Description
Using qtwebchannel I found that is it possible to return objects in functions to the js side. But if you try to pass this objects back to the server you receive null.
The problem is that in QMetaObjectPublisher::invokeMethod the arguments are passed to a QVariant and are checked if the methods parameter type is QVariant or if the arguments variant can be converted to the parameters type. The is no check of the id of the json object (_id_). You can check this id against the wrappedObjects map or the registeredObjectIds map and pass the appropiate object.
To keep the data transfer small you could just pass the objects id and not the whole json object if the id is in webchannel.objects on the js side.