Widget for a foldable container in qml

264 views Asked by At

What qml widget should I use to create a foldable container? I can't find it.

Example (from Qt Creator):

enter image description here

1

There are 1 answers

0
Petar On BEST ANSWER

There is no out of the box widget in QML for that but it should be fairly easy to create it yourself. This is just a primitive example to show how easy it could be to do it but a proper reusable control might be implementend similar like 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"
    }
}