62 lines
1.4 KiB
QML
62 lines
1.4 KiB
QML
|
import QtQuick 2.9
|
||
|
import QtQuick.Controls 2.2
|
||
|
|
||
|
Page {
|
||
|
id: root
|
||
|
anchors.fill: parent
|
||
|
header: ToolBar {
|
||
|
contentHeight: toolButton.implicitHeight
|
||
|
|
||
|
ToolButton {
|
||
|
id: toolButton
|
||
|
text: stackView.depth > 1 ? "\u25C0" : "\u2630"
|
||
|
font.pixelSize: Qt.application.font.pixelSize * 1.6
|
||
|
onClicked: {
|
||
|
if (stackView.depth > 1) {
|
||
|
stackView.pop()
|
||
|
} else {
|
||
|
drawer.open()
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
Label {
|
||
|
text: stackView.currentItem.title
|
||
|
anchors.centerIn: parent
|
||
|
}
|
||
|
}
|
||
|
|
||
|
Drawer {
|
||
|
id: drawer
|
||
|
width: window.width * 0.66
|
||
|
height: window.height
|
||
|
|
||
|
Column {
|
||
|
anchors.fill: parent
|
||
|
|
||
|
ItemDelegate {
|
||
|
text: qsTr("page 1")
|
||
|
width: parent.width
|
||
|
onClicked: {
|
||
|
stackView.push("Page1Form.qml")
|
||
|
drawer.close()
|
||
|
}
|
||
|
}
|
||
|
ItemDelegate {
|
||
|
text: qsTr("Page 2")
|
||
|
width: parent.width
|
||
|
onClicked: {
|
||
|
stackView.push("Page2Form.qml")
|
||
|
drawer.close()
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
StackView {
|
||
|
id: stackView
|
||
|
initialItem: "HomeForm.qml"
|
||
|
anchors.fill: parent
|
||
|
}
|
||
|
}
|