diff --git a/examples/quick/controls/stackview/ButtonMenu.qml b/examples/quick/controls/stackview/ButtonMenu.qml index c1608f7e166c68ffc29aab54b5f050e4002b1658..f10490e7125dfd7f0629696a6133283d38696c82 100644 --- a/examples/quick/controls/stackview/ButtonMenu.qml +++ b/examples/quick/controls/stackview/ButtonMenu.qml @@ -40,22 +40,45 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 +import QtQuick.Layouts 1.0 -Column { +GridLayout { + columns: 4 property int index: -1 + rowSpacing: 5 + columnSpacing: 5 Label { - text: "stack index: " + index + Layout.rowSpan: 2 + text: "Stack Index: " + index } Button { - text: "push Component" + text: "Push New Component" onClicked: stackView.push(componentPage) } Button { - text: "push URL" + text: "Push New URL" onClicked: stackView.push(Qt.resolvedUrl("View.qml")) } Button { - text: "pop" + text: "Back" + enabled: index !== 0 onClicked: stackView.pop() } + + RowLayout { + Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft + Layout.columnSpan: 3 + spacing: 5 + Label { text: "Jump to index:" } + ComboBox { + model: stackView.depth + currentIndex: stackView.currentItem.Stack.index + enabled: stackView.depth > 1 + onCurrentIndexChanged: { + if (stackView.currentItem !== null && + currentIndex !== stackView.currentItem.Stack.index) + stackView.pop(stackView.get(currentIndex, true)) + } + } + } } diff --git a/examples/quick/controls/stackview/View.qml b/examples/quick/controls/stackview/View.qml index e713e0e5a2de61543f91307b0d4a103e91376bf1..858bac61d38eab6eabe7a051e06f591412d058cf 100644 --- a/examples/quick/controls/stackview/View.qml +++ b/examples/quick/controls/stackview/View.qml @@ -40,10 +40,15 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 +import QtQuick.Layouts 1.0 -Rectangle { - color: "green" +ColumnLayout { + Label { + text:"View.qml loaded with index: " + parent.Stack.index + Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter + } ButtonMenu { + Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter index: parent.Stack.index } } diff --git a/examples/quick/controls/stackview/main.qml b/examples/quick/controls/stackview/main.qml index af016fb286f6e8a51e0d6c07e44a9f2e9548bd34..f81c830903558c381b9daa3b54463291310f98ee 100644 --- a/examples/quick/controls/stackview/main.qml +++ b/examples/quick/controls/stackview/main.qml @@ -40,6 +40,7 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 +import QtQuick.Layouts 1.0 ApplicationWindow { width: 480 @@ -55,9 +56,13 @@ ApplicationWindow { Component { id: componentPage - Rectangle { - color: "yellow" + ColumnLayout { + Label { + text:"Component loaded with index: " + parent.Stack.index + Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter + } ButtonMenu { + Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter index: parent.Stack.index } }