MainMenu component was added
This commit is contained in:
51
qml/main.qml
51
qml/main.qml
@@ -18,7 +18,7 @@ ApplicationWindow {
|
||||
anchors.fill: parent
|
||||
MenuBackButton {
|
||||
state: "menu"//stackView.depth > 1 ? "back" : "menu"
|
||||
onClicked: drawer.open()
|
||||
onClicked: mainMenu.open()
|
||||
onBack: {
|
||||
state = "menu"
|
||||
}
|
||||
@@ -51,44 +51,31 @@ ApplicationWindow {
|
||||
}
|
||||
}
|
||||
|
||||
Drawer {
|
||||
id: drawer
|
||||
MainMenu {
|
||||
id: mainMenu
|
||||
|
||||
readonly property var actions: {
|
||||
"settings": () => { stackView.openPage("SettingsForm.qml") },
|
||||
"quit": () => { Qt.quit() }
|
||||
}
|
||||
|
||||
width: parent.width * 0.66
|
||||
height: parent.height
|
||||
|
||||
Column {
|
||||
anchors.fill: parent
|
||||
logo: "qrc:/logo.png"
|
||||
appName: qsTr("BeerLog v0.1")
|
||||
|
||||
Row {
|
||||
width: parent.width
|
||||
height: 100
|
||||
|
||||
Image {
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.margins: 10
|
||||
source: "logo.png"
|
||||
}
|
||||
|
||||
Label {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
font.pointSize: 20
|
||||
text: qsTr("BeerLog v0.1")
|
||||
}
|
||||
model: ListModel {
|
||||
ListElement {
|
||||
title: qsTr("Settings")
|
||||
action: "settings"
|
||||
}
|
||||
|
||||
ItemDelegate {
|
||||
text: qsTr("Settings")
|
||||
width: parent.width
|
||||
onClicked: stackView.openPage("SettingsForm.qml")
|
||||
}
|
||||
|
||||
ItemDelegate {
|
||||
text: qsTr("Quit")
|
||||
width: parent.width
|
||||
onClicked: Qt.quit()
|
||||
ListElement {
|
||||
title: qsTr("Quit")
|
||||
action: "quit"
|
||||
}
|
||||
}
|
||||
|
||||
onActionSelected: (action) => actions[action]()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user