summaryrefslogtreecommitdiff
path: root/tests/manual
diff options
context:
space:
mode:
authorCaroline Chao <caroline.chao@digia.com>2013-05-13 12:42:12 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-05-13 13:17:40 +0200
commitebf104a6f2263da7435801e88a3f5c8505358768 (patch)
tree22d73842342c70e7b68cf8e9d6cabf57bbc68709 /tests/manual
parent89de921c2f6928a691f6aaa2165b5c1739f156cd (diff)
downloadqtquickcontrols-ebf104a6f2263da7435801e88a3f5c8505358768.tar.gz
Move stackview example to manual tests folder
Change-Id: I5d9b39531a866d7fc5765332d364e6e2793b5b13 Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
Diffstat (limited to 'tests/manual')
-rw-r--r--tests/manual/stackview/ButtonMenu.qml84
-rw-r--r--tests/manual/stackview/View.qml54
-rw-r--r--tests/manual/stackview/main.qml70
-rw-r--r--tests/manual/stackview/stackview.qmlproject16
4 files changed, 224 insertions, 0 deletions
diff --git a/tests/manual/stackview/ButtonMenu.qml b/tests/manual/stackview/ButtonMenu.qml
new file mode 100644
index 00000000..f10490e7
--- /dev/null
+++ b/tests/manual/stackview/ButtonMenu.qml
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.0
+import QtQuick.Layouts 1.0
+
+GridLayout {
+ columns: 4
+ property int index: -1
+ rowSpacing: 5
+ columnSpacing: 5
+ Label {
+ Layout.rowSpan: 2
+ text: "Stack Index: " + index
+ }
+ Button {
+ text: "Push New Component"
+ onClicked: stackView.push(componentPage)
+ }
+ Button {
+ text: "Push New URL"
+ onClicked: stackView.push(Qt.resolvedUrl("View.qml"))
+ }
+ Button {
+ 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/tests/manual/stackview/View.qml b/tests/manual/stackview/View.qml
new file mode 100644
index 00000000..858bac61
--- /dev/null
+++ b/tests/manual/stackview/View.qml
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.0
+import QtQuick.Layouts 1.0
+
+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/tests/manual/stackview/main.qml b/tests/manual/stackview/main.qml
new file mode 100644
index 00000000..f81c8309
--- /dev/null
+++ b/tests/manual/stackview/main.qml
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.0
+import QtQuick.Layouts 1.0
+
+ApplicationWindow {
+ width: 480
+ height: 640
+ property alias stackView: stackView
+ property alias componentPage: componentPage
+
+ StackView {
+ id: stackView
+ anchors.fill: parent
+ initialItem: componentPage
+ }
+
+ Component {
+ id: componentPage
+ 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
+ }
+ }
+ }
+}
diff --git a/tests/manual/stackview/stackview.qmlproject b/tests/manual/stackview/stackview.qmlproject
new file mode 100644
index 00000000..e5a8bf02
--- /dev/null
+++ b/tests/manual/stackview/stackview.qmlproject
@@ -0,0 +1,16 @@
+import QmlProject 1.1
+
+Project {
+ mainFile: "main.qml"
+
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+}