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

FlexboxLayout in ColumnLayout unintentional space below

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • 6.10
    • Quick: Layouts
    • None

      When adding items to a FlexboxLayout that is contained in a ColumnLayout it creates a space/gap below the layout depending on how many items are in the FlexboxLayout. When using Flow this is not the case. The issue is shown is the following screenshots and can be reproduced with the code snippet below. The gray Rectangle is the last item in the ColumnLayout and gets pushed down depending on how many items the FlexboxLayout contains.



      import QtQuick
      import QtQuick.Controls
      import QtQuick.Layouts
      
      Window {
          id: root
      
          width: 640
          height: 480
          visible: true
          title: qsTr("Hello World")
      
          property int numRectangles: 0
      
          ColumnLayout {
              RowLayout {
                  Button {
                      text: "Add"
                      onClicked: ++root.numRectangles
                  }
      
                  Button {
                      text: "Remove"
                      onClicked: root.numRectangles = Math.max(0, --root.numRectangles)
                  }
              }
      
              FlexboxLayout {
                  wrap: FlexboxLayout.Wrap
                  direction: FlexboxLayout.Row
                  justifyContent: FlexboxLayout.JustifyStart
      
                  rowGap: 8
                  columnGap: 8
      
                  Repeater {
                      model: root.numRectangles
      
                      Rectangle {
                          width: 30
                          height: 30
                          color: Qt.rgba(Math.random(),Math.random(),Math.random(),1)
                      }
                  }
              }
      
              Rectangle {
                  width: 60
                  height: 30
                  color: "gray"
              }
          }
      }
      

        1. image-2025-10-22-09-59-21-275.png
          12 kB
          Henning Gründl
        2. image-2025-10-22-09-59-51-753.png
          11 kB
          Henning Gründl
        3. image-2025-10-22-10-00-15-710.png
          11 kB
          Henning Gründl
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            henning Henning Gründl
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes