qml 中可折叠容器的小部件
Widget for a foldable container in qml
我应该使用什么 qml 小部件来创建可折叠容器?我找不到了。
示例(来自 Qt Creator):
QML 中没有开箱即用的小部件,但您自己创建它应该相当容易。这只是一个简单的例子来说明这样做是多么容易,但是一个适当的可重用控件可能会被实现,类似于 https://doc.qt.io/qt-5/qml-qtquick-controls2-tabbar.html:
import QtQuick 2.11
Column {
width: 600
height: 600
Rectangle {
width: parent.width
height: 50
color: "darkgrey"
MouseArea {
anchors.fill: parent
onClicked: container.height = container.height ? 0 : 500
}
}
Rectangle {
id: container
width: parent.width
height: 500
color: "grey"
}
}
我应该使用什么 qml 小部件来创建可折叠容器?我找不到了。
示例(来自 Qt Creator):
QML 中没有开箱即用的小部件,但您自己创建它应该相当容易。这只是一个简单的例子来说明这样做是多么容易,但是一个适当的可重用控件可能会被实现,类似于 https://doc.qt.io/qt-5/qml-qtquick-controls2-tabbar.html:
import QtQuick 2.11
Column {
width: 600
height: 600
Rectangle {
width: parent.width
height: 50
color: "darkgrey"
MouseArea {
anchors.fill: parent
onClicked: container.height = container.height ? 0 : 500
}
}
Rectangle {
id: container
width: parent.width
height: 500
color: "grey"
}
}