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

REG[5.1.1-5.2.1] Qt.Binding doesn't detect signal attribute

    XMLWordPrintable

Details

    • macOS

    Description

      Test attached sample application. See that on Qt 5.1.1 Qt.Binding works fine but later releases it returns error:
      TypeError: Cannot call method 'invokableMethod' of undefined

      Bug is produced if the pointer used in Qt.Binding is c++ signal attribute. If pointer is set to local JS variable then it works. See from the sample code that aItem is signal attribute that fails. If it's set to bItem variable then Qt.Binding works.

                  // WORKAROUND is to set aItem to helper variable
      //            var bItem = aItem
                  var object = component.createObject(mainWindow,  {
                                                        "someint" : Qt.binding(function() { return aItem.invokableMethod(someVariable) })
                                                        // WORKAROUND to read from helper variable
      //                                                  "someint" : Qt.binding(function() { return bItem.invokableMethod(someVariable) })
                                                      })
      

      It should work without the hack like it works in Qt 5.1.1.

      Attachments

        1. QTBUG-47220.zip
          7 kB
          Qt Support
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qtqmlteam Qt Qml Team User
            qtcomsupport Qt Support
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes