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

QWebChannel make passing objects from js to server possible

    XMLWordPrintable

Details

    • Task
    • Resolution: Done
    • Not Evaluated
    • 5.6.2
    • None
    • WebChannel
    • 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.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes