-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.15.7, 6.2.1
-
fe66830abe869d7e7244c77779c9ff7aa51037c3 (qt/qtdeclarative/dev) 463d16de5d41647267008fdd4a6460b8c00f5434 (qt/qtdeclarative/6.2)
When preferredWidth/Height is set with fillWidth/Height, layouts use preferredWidth/Height as a weight when laying out elements. For example this reserves 2/3 for the red and 1/3 for the blue rectangle:
RowLayout { anchors.fill: parent Rectangle { Layout.fillWidth: true Layout.fillHeight: true Layout.preferredWidth: 100 color: "red" } Rectangle { Layout.fillWidth: true Layout.fillHeight: true Layout.preferredWidth: 50 color: "blue" } }
This behavior does not seem to be mentioned in the documentation:
https://doc.qt.io/qt-5/qml-qtquick-layouts-layout.html#fillWidth-attached-prop
https://doc.qt.io/qt-5/qml-qtquick-layouts-layout.html#preferredWidth-attached-prop
For Gerrit Dashboard: QTBUG-98127 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
384017,2 | Doc: Make algorithm for distributing sizes in layouts more explicit | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
384997,2 | Doc: Make algorithm for distributing sizes in layouts more explicit | 6.2 | qt/qtdeclarative | Status: MERGED | +2 | 0 |