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

[REG 6.4.1->6.5.0] Qt.binding in initial properties silently fails for certain types

    XMLWordPrintable

Details

    • 57e272fbd (dev), 91d512789 (6.5)

    Description

      With 6.5, setting a 'color' property to a Qt.binding() in initial properties silently fails and the binding is never evaluated. The same assignment works normally after construction. Only certain property types like 'color' are affected; qreal and string properties are fine.

      Example:

      import QtQuick
      Item {
          id: root
          Component {
              id: rectangle
              Rectangle { }
          }
          Component.onCompleted: {
              let colorCalled = false
              let radiusCalled = false
              let obj = rectangle.createObject(root, {
                  color: Qt.binding(() => { colorCalled = true; return '#ff0000' }),
                  radius: Qt.binding(() => { radiusCalled = true; return 5 })
              })
              console.warn("color", obj.color, "evaluated", colorCalled)
              console.warn("radius", obj.radius, "evaluated", radiusCalled)
          }
      } 

      Output with 6.5.0:

      qml: color #000000 evaluated false
      qml: radius 5 evaluated true

      Expected output:

      qml: color #ff0000 evaluated true
      qml: radius 5 evaluated true

       

      Attachments

        For Gerrit Dashboard: QTBUG-113472
        # Subject Branch Project Status CR V

        Activity

          People

            fabiankosmale Fabian Kosmale
            special John Brooks
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes