所以我想做的是通过单击鼠标展开单个 GridView 行。它看起来应该有点类似于 this .想象一下,在鼠标单击之前,行之间的距离相等,然后行垂直展开,当菜单关闭时,行又恢复到正常间距。
使用标准 GridView 是否可行,还是我必须创建自己的?我试过 cellHeight,但这会改变每一行的高度,而不仅仅是当前行的高度。
最佳答案
如果您不使用 GridView 而是使用包含三行的列,可能会更容易。您可以在不需要时简单地使中间行不可见。这将使 UI 更加灵活。
这应该是这样的:
property bool informationsVisible: false
Column {
anchors.fill: parent
Row {
id: firstRow
Repeater {
model: firstHalfOfYourData
delegate: MouseArea {
//Your item representation
}
}
}
Row {
id: informationsRow
visible: informationsVisible
//Display informations on the selected element here
}
Row {
id: secondRow
Repeater {
model: secondHalfOfYouData
delegate: MouseArea {
//Your item representation
}
}
}
}
关于c++ - 如何使整个 GridView 行垂直展开,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23146744/