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

[QML][Layout] top/bottomMargin with fillHeight components

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.12.9
    • Quick: Layouts
    • None
    • Windows

    Description

      Hi,

      I'm facing a problem regarding top / bottom margin on components inside a layout (GridLayout here, but it seems to be the same with a ColumnLayout) with fillHeight.

      Considering the following example :

       

      import QtQuick 2.0
      import QtQuick.Layouts 1.2
      
      Item {
          width : 800
          height : 480
          GridLayout {
              anchors.fill: parent
              columns: 2
              rows : 2
              Rectangle {
                  color:"red"
                  Layout.fillHeight: true
                  width : 400
              }
              Rectangle {
                  color:"green"
                  Layout.rowSpan: 2
                  Layout.fillHeight: true
                  width : 400
              }
              Rectangle {
                  color:"blue"
                  Layout.fillHeight: true
                  width : 400
                  Layout.bottomMargin: 10
              }
          }
      }
      

      The display is as WithBottom.jpg.

       

      Just commenting the line "Layout.bottomMargin: 10" restablish the ratio between red and blue rectangles (see WithoutBottom.jpg).

       

      There seem to be a ratio calculated that take into account the margins when my guess is that it shouldn't. Indeed, the height of the blue rectangle seems to be (top+bottom margins)*height of the red one (I've tested with like a dozen values, maybe not enough).

       

      Attachments

        1. WithBottom.jpg
          WithBottom.jpg
          24 kB
        2. WithoutBottom.jpg
          WithoutBottom.jpg
          24 kB
        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
            jonathanf Jonathan Faure
            Votes:
            4 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes