Yes, it's technically an untyped JavaScript function... but could we check the type of the property instead?

       

      Code

      import QtQuick
      import QtQuick.Controls.Basic
      
      Window {
          id: root
          width: 300
          height: 200
          visible: true
      
          property color myColor: "green"
      
          Column {
              Rectangle {
                  id: rectangle
                  width: 100
                  height: 100
                  color: "red"
                  border.color: "black"
                  border.width: 5
              }    
              Button {
                  text: "Update color binding"
                  onClicked: rectangle.color = Qt.binding(function() {return root.myColor})
              }
          }
      }
      
      

       

      Compiler output

      Warning: main.qml:23:33: Could not compile binding for onClicked: Cannot generate efficient code for LoadClosure [compiler]
                  onClicked: rectangle.color = Qt.binding(function() {return root.myColor})
                                               ^^
      

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

            qtqmlteam Qt Qml Team User
            skoh-qt Sze Howe Koh
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes