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

Quick Layouts behaviour regression

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P1: Critical P1: Critical
    • None
    • 6.4.1
    • Quick: Layouts
    • None
    • All

      Starting with 6.4.1 (possibly 6.4.0 too, haven't checked) I'm seeing some odd behaviour regarding nested ColumnLayouts in combination with Layout.preferredWidth.

          ColumnLayout
          {
              anchors.fill: parent
      
              ColumnLayout
              {
                  Rectangle
                  {
                      id: mainRect
                      Layout.preferredWidth: 160
                      Layout.fillHeight: true
                      color: "blue"
                  }
      
                  Rectangle
                  {
                      onWidthChanged: console.log("green rect", width);
                      implicitWidth: mainRect.width
                      implicitHeight: 10
                      color: "green"
                  }
      
                  Rectangle
                  {
                      onWidthChanged: console.log("red rect", width);
                      implicitWidth: mainRect.width
                      implicitHeight: 10
                      color: "red"
                  }
              }
          }
      

      On 6.3.2 I see this:

      qml: green rect 160
      qml: red rect 160
      

      On 6.4.1, this is the situation:

      qml: green rect 160
      qml: red rect 160
      qml: red rect 0
      

      It doesn't make sense that the red rectangle is a different width to the green one, given their implicitWidth bindings being identical. Nor is it clear why its width gets set correctly initially, and is then zeroed.

      Interestingly, if I replace

      Layout.preferredWidth: 160

      ...with...

      implicitWidth: 160

      I get the 6.3.x behaviour.

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

            mikolaj.boc MikoĊ‚aj Boc (Inactive)
            timangus Tim Angus
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes