Details

    Description

      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})
                                               ^^
      

      Attachments

        Issue Links

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

          Activity

            People

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

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes