PDA

View Full Version : How to change Rectangle height that is inside a ColumnLayout?



lqsa
15th June 2016, 02:28
I've this code:


import QtQuick 2.5
import QtQuick.Layouts 1.1
import QtQuick.Controls 1.4
ColumnLayout {
spacing: 0
Rectangle {
Layout.fillWidth: true
height: 30
color: "blue"
Button {
text: "expand"
onClicked: r.height = 50
}
}
Rectangle {
id: r
Layout.fillWidth: true
height: 20
color: "red"
}
Rectangle {
Layout.fillWidth: true
Layout.fillHeight: true
color: "lightgray"
}
}

When the button is pushed, the Rectangle r doesn't change the height. However, if the last Rectangle is changed by an Item, the height is changed.

anda_skoa
15th June 2016, 08:51
Interesting.
The height changes but the layout doesn't update.

But it works if you use "implicitHeight" instead of "height" for the red rectangle

Cheers,
_