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

Qml: Binding on deferred property not reliable

XMLWordPrintable

      Using a Binding on a "deferred property" is not reliable.

      Please see the following example: the background should become blue (for demonstration purposes, actually it should just have some background color without a frame).

      Interestingly, setting the property to null works.

      Motivation for this was to compensate for the behavior change from Qt 6.9.2 to 6.9.3 due to the fix for QTBUG-139715 by adding a frameless property to some TextArea based control.

      import QtQuick
      import QtQuick.Controls.Fusion
      
      ApplicationWindow {
        id: root
      
        width: 640
        height: 480
        visible: true
        title: qsTr("Hello World")
      
        TextArea {
          id: editor
      
          anchors {
            fill: parent
            margins: 10
          }
      
          text: "Foo"
      
          // works
          // background: Rectangle { implicitWidth: 10; implicitHeight: 10; color: "blue" }
      
          Binding {
            // does *not* work
            editor.background: Rectangle { implicitWidth: 10; implicitHeight: 10; color: "blue" }
      
            // works:
            // editor.background: null
      
            when: true // real application would e.g. bind this to some "frameless" property
          }
        }
      }
      

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

            qtqmlteam Qt Qml Team User
            njeisecke_qtc Nils Jeisecke
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes