Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-50075

QWebChannel make passing objects from js to server possible

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Done
    • Icon: Not Evaluated Not Evaluated
    • 5.6.2
    • None
    • WebChannel
    • None
    • I used qtwebchannel from qts github repository in dev branch

      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.

        For Gerrit Dashboard: QTBUG-50075
        # Subject Branch Project Status CR V

            milianw Milian Wolff
            Psy-Kai Kai Dohmen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes