2022-05-13 13:12:05 +00:00
|
|
|
// Copyright (C) 2017 The Qt Company Ltd.
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
2015-12-14 18:06:53 +00:00
|
|
|
|
2023-02-22 08:53:32 +00:00
|
|
|
pragma ComponentBehavior: Bound
|
|
|
|
|
2020-03-26 16:01:51 +00:00
|
|
|
import QtQuick
|
|
|
|
import QtQuick.Controls
|
2015-12-14 18:06:53 +00:00
|
|
|
|
|
|
|
StackView {
|
|
|
|
id: stackView
|
|
|
|
initialItem: page
|
2025-05-23 08:23:27 +00:00
|
|
|
enabled: !GalleryConfig.disabled
|
2015-12-14 18:06:53 +00:00
|
|
|
|
|
|
|
Component {
|
|
|
|
id: page
|
|
|
|
|
|
|
|
Pane {
|
|
|
|
id: pane
|
|
|
|
width: parent ? parent.width : 0 // TODO: fix null parent on destruction
|
|
|
|
|
|
|
|
Column {
|
|
|
|
spacing: 40
|
|
|
|
width: parent.width
|
|
|
|
|
|
|
|
Label {
|
|
|
|
width: parent.width
|
|
|
|
wrapMode: Label.Wrap
|
2015-12-18 15:32:00 +00:00
|
|
|
horizontalAlignment: Qt.AlignHCenter
|
2023-02-23 13:17:52 +00:00
|
|
|
text: qsTr("StackView provides a stack-based navigation model which can be used with a set of interlinked pages. "
|
2016-02-09 12:44:13 +00:00
|
|
|
+ "Items are pushed onto the stack as the user navigates deeper into the material, and popped off again "
|
2023-02-23 13:17:52 +00:00
|
|
|
+ "when he chooses to go back.")
|
2015-12-14 18:06:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Button {
|
|
|
|
id: button
|
2023-02-23 13:17:52 +00:00
|
|
|
text: qsTr("Push")
|
2015-12-14 18:06:53 +00:00
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
2015-12-18 15:32:00 +00:00
|
|
|
width: Math.max(button.implicitWidth, Math.min(button.implicitWidth * 2, pane.availableWidth / 3))
|
2015-12-14 18:06:53 +00:00
|
|
|
onClicked: stackView.push(page)
|
|
|
|
}
|
|
|
|
|
|
|
|
Button {
|
2023-02-23 13:17:52 +00:00
|
|
|
text: qsTr("Pop")
|
2015-12-14 18:06:53 +00:00
|
|
|
enabled: stackView.depth > 1
|
2015-12-18 15:32:00 +00:00
|
|
|
width: Math.max(button.implicitWidth, Math.min(button.implicitWidth * 2, pane.availableWidth / 3))
|
2015-12-14 18:06:53 +00:00
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
onClicked: stackView.pop()
|
|
|
|
}
|
2023-02-22 08:53:32 +00:00
|
|
|
|
|
|
|
Label {
|
|
|
|
width: parent.width
|
|
|
|
wrapMode: Label.Wrap
|
|
|
|
horizontalAlignment: Qt.AlignHCenter
|
2023-02-23 13:17:52 +00:00
|
|
|
text: qsTr("Stack Depth:") + " " + stackView.depth
|
2023-02-22 08:53:32 +00:00
|
|
|
}
|
2015-12-14 18:06:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|