go-qamel / qamel

Simple QML binding for Go
MIT License
176 stars 19 forks source link

Slide menu? #13

Closed MostHated closed 5 years ago

MostHated commented 5 years ago

Hey there, I like what this can do so far and am excited to use it. I didn't see anything similar in this demo, but are the slide out menus able to be used in this package? I know qamel said it was simple, but not sure if that means that things like slide menus were not able to be used or not.

Thanks, -MH

RadhiFadlillah commented 5 years ago

Slide menu like in Android ? Yes, you can do it using QML Drawer.

To try it, create the hello world project, then replace res/main.qml content with this :

import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Controls.Material 2.12

Rectangle {
    color: "#EEE"

    Drawer {
        id: drawer

        interactive: true
        height: parent.height
        width: Math.min(200, parent.width / 2)

        ListView {
            id: listView

            model: 10
            anchors.fill: parent
            headerPositioning: ListView.OverlayHeader
            ScrollIndicator.vertical: ScrollIndicator { }

            delegate: ItemDelegate {
                text: `Title ${index}`
                width: parent.width
            }
        }
    }

    Button {
        text: "Open Drawer"
        anchors.verticalCenter: parent.verticalCenter
        anchors.horizontalCenter: parent.horizontalCenter
        onClicked: drawer.open()
    }
}

Run it, and it should look like this :

qamel-drawer

RadhiFadlillah commented 5 years ago

Since it seems there are no problem anymore, I will close this issue. Feels free to reopen it if needed.