I'm new to Qt and QML. Examples I have seen recommend wrapping components with an Item. I want the thing the item contains to be positioned at the bottom of the application window. So, I set the item's anchor.bottom to parent.bottom. This makes the contained thing not show up. This tiny example shows the issue where the contained 'thing' is a Rectangle.
Window {
width: 800
height: 500
visible: true
title: qsTr("Test")
Item {
anchors {
bottom: parent.bottom
}
Rectangle {
width: 80
height: 80
color: "#FF0000"
}
}
}
I realize the item has no explicit height and its implicit height is initially 0. I believe the item's anchor is applied when the item has no height. So its bottom is its top. So its top gets set to the window bottom, effectively locating it below the window. But, the contained rectangle has a height. Does the item not dynamically size before the anchor is applied?
Is there a proper way to do this other than just deleting the Item wrapper? In my actual code, the item is not wrapping a simple rectangle. It wraps a RowLayout that contains multiple things that are not the same height. I want the RowLayout to dynamically size its height.