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

[Reg 6.1 -> 6.2] Cannot overwrite property bindings in aliased elements

    XMLWordPrintable

Details

    • 5ff83606a1c1365b95cd12ef9d45bc4e4eb13ecd (qt/qtdeclarative/dev) a038dadf770ddb2697e8404741235317cf2a6674 (qt/qtdeclarative/6.2)

    Description

      If you set up a binding on properties of a child item in a QML component and export that child item as alias, then you cannot overwrite that binding on the exported child item anymore from the outside.

      See attached example: The red 'textElement' item inside Button.qml has its width/height bound to parent.width/height and it is exported as 'text' alias.
      In test.qml the width/height is overwritten with constant values.

      When this example is run with Qt 5, the red rectangle has the correct width/height of 10px, because the internal binding is broken up.
      When this example is run with Qt 6.2.0-rc1, the red rectangle is always resized to the width/height of the parent element...
      Adding debug output to onWidth/HeightChanged shows that the constant values are set once, but afterwards textElement.width/height are changed again, so it looks like the binding is still active and not broken up

      So is this regression done on purpose? If yes, how are we supposed to set dynamic default values for properties now that can be overwritten from the outside?
      In any case, this behavior change might break a lot of existing code...

      Attachments

        1. Button.qml
          0.3 kB
        2. geometrybindingbug.zip
          37 kB
        3. test.qml
          0.3 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qtqmlteam Qt Qml Team User
            tokoe.kdab Tobias Koenig
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes