make the group foldable

This commit is contained in:
Sam Gateau 2019-03-07 17:52:11 -08:00
parent f7896b6407
commit 5b8116bec4

View file

@ -25,6 +25,8 @@ Item {
property var label: "group" property var label: "group"
property var isUnfold: false
Item { Item {
id: header id: header
height: global.slimHeight height: global.slimHeight
@ -39,6 +41,7 @@ Item {
text: root.label text: root.label
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
} }
Rectangle { Rectangle {
id: headerRect id: headerRect
color: global.color color: global.color
@ -50,11 +53,20 @@ Item {
anchors.right: header.right anchors.right: header.right
anchors.verticalCenter: header.verticalCenter anchors.verticalCenter: header.verticalCenter
height: parent.height height: parent.height
MouseArea{
id: mousearea
anchors.fill: parent
onDoubleClicked: {
root.isUnfold = !root.isUnfold
}
}
} }
} }
Column { Column {
id: column id: column
visible: root.isUnfold
anchors.top: header.bottom anchors.top: header.bottom
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
@ -62,7 +74,7 @@ Item {
// Where the propItems are added // Where the propItems are added
} }
height: header.height + column.height height: header.height + isUnfold * column.height
function updatePropItems() { function updatePropItems() {
for (var i = 0; i < root.propItems.length; i++) { for (var i = 0; i < root.propItems.length; i++) {