Details
-
Bug
-
Resolution: Invalid
-
P2: Important
-
None
-
5.13.1
-
None
Description
When using GridLayout, and setting Layout.fillWidth or Layout.fillHeight for the elements inside the grid, they do not respect Layout.columnSpan or Layout.rowSpan but seems to divide the space equally between the elements contending it.
Code example:
import QtQuick 2.13 import QtQuick.Window 2.13 import QtQuick.Layouts 1.13 Window { visible: true width: 800 height: 600 GridLayout { anchors.fill: parent rows: 1 columns: 10 columnSpacing: 0 Rectangle { Layout.columnSpan: 1 Layout.fillWidth: true Layout.fillHeight: true color: "red" } Rectangle { Layout.columnSpan: 9 Layout.fillWidth: true Layout.fillHeight: true color: "green" } } }
Actual result: the elements with fillWidth contend equally the space of the grid.
Expected result: the elements with fillWidth occupy a space which is proportional to their columnSpan relatively to the other elements.
This looks like a contradiction from what the documentation itself says about fill size properties:
If this property is true, the item will be as wide as possible while respecting the given constraints
If I understand correctly, columnSpan and rowSpan are constraints.
Other relevant discussions:
https://stackoverflow.com/questions/34027727/how-can-i-create-a-qml-gridlayout-with-items-of-proportionate-sizes
https://stackoverflow.com/questions/24674086/qml-gridlayout-span