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

Nested layout with 0 implicitHeight not handled correctly

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.15, 6.7
    • Quick: Layouts
    • None
    • All

    Description

      A ColumnLayout with 0 implicit height nested in another ColumnLayout no longer get handled correctly after merging commit https://codereview.qt-project.org/c/qt/qtdeclarative/+/297828 .

      Here's a minimum example to reproduce this issue:

      import QtQuick 2.12
      import QtQuick.Window 2.12
      import QtQuick.Controls 2.12
      import QtQuick.Layouts 1.12
      
      Window {
          width: 300
          height: 400
          visible: true
      
          ColumnLayout {
              anchors.left: parent.left
              anchors.right: parent.right
      
              Label {
                  Layout.fillWidth: true
                  text: "Text 1"
              }
      
              ColumnLayout {
                  Layout.fillWidth: true
      
                  Label {
                      Layout.fillWidth: true
                      text: "Sub Text"
                      visible: showSwitch.checked
                  }
              }
      
              Label {
                  Layout.fillWidth: true
                  text: "Text 2"
              }
          }
      
          Switch {
              id: showSwitch
              anchors.centerIn: parent
              text: "Show Sub Text"
              checked: true
          }
      } 

      When we uncheck the "Show Sub Text" switch, the height of nested ColumnLayout is unchanged, leaving unexpected blank between two Labels.

      Attachments

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

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            gpbeta Joshua GPBeta
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes