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

qwebchannel.js: using a QObject* as argument for a slot called from a script doesn't work. unwrapObject fails

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Incomplete
    • Not Evaluated
    • None
    • 5.9.4
    • WebChannel
    • None

    Description

      #3 from QTBUG-67592

      Assuming the QObject* 'o' is already exposed to the scripting side, as a property of another QObject for ex. Calling slot(o) fails with the following error message "Cannot not convert non-object argument xxx to QObject*.", even though the QObject was published to javascript by Qt without problem. (all its properties, slots, can be seen in Chrome/Inspect).

      This is because QMetaObjectPublisher looks for a value for the "id" field on the Json data provided from javascript and doesn't find it. In fact it is not symetrical with what qwebchannel.js is doing: the script fills a '_id_' field instead.

      To test I modified the qwebchannel.js as follow:

      function QObject(name, data, webChannel)
      {
          this.__id__ = name;
          this.id = name; // CC: QMetaObjectPublisher looks for KEY_ID = "id" when calling unwrapObject(value.toObject()[KEY_ID].toString());
      ...
      

      Attachments

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

        Activity

          People

            cassan Claire Cassan
            cassan Claire Cassan
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes