add navbar

This commit is contained in:
王劲鹏 2021-06-09 11:44:27 +08:00 committed by osborn
parent dba0569256
commit 37ef313c10

View File

@ -1,16 +1,34 @@
import QtQuick 2.12
import QtQuick.Controls 2.5
import QtQuick.Layouts 1.15
ApplicationWindow {
visible: true
width: 600
height: 800
height: 844
title: qsTr("Doric Demo")
ColumnLayout{
spacing: 0
anchors.fill: parent
Rectangle {
id: navbar
color: "red"
visible: false
Layout.fillWidth: true
Layout.preferredHeight: 44
}
Rectangle {
Layout.fillWidth: true
Layout.fillHeight: true
StackView {
id: stack
objectName: "stackView"
anchors.fill: parent
initialItem: ScrollView {
id: entry
@ -22,6 +40,8 @@ ApplicationWindow {
ListView {
width: parent.width
model: 23
boundsBehavior: Flickable.StopAtBounds
delegate: Rectangle {
Column {
anchors.centerIn: parent
@ -90,8 +110,24 @@ ApplicationWindow {
}
}
}
}
}
function navigatorPush(page) {
stack.push(page)
if (stack.depth > 1) {
navbar.visible = true
} else {
navbar.visible = false
}
}
function navigatorPop() {
stack.pop()
if (stack.depth > 1) {
navbar.visible = true
} else {
navbar.visible = false
}
}
}