Warning, /frameworks/kirigami/examples/simpleexamples/pushpopclear.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  *  SPDX-FileCopyrightText: 2016 Marco Martin <mart@kde.org>
0003  *
0004  *  SPDX-License-Identifier: LGPL-2.0-or-later
0005  */
0006 
0007 import QtQuick
0008 import QtQuick.Controls as QQC2
0009 import org.kde.kirigami as Kirigami
0010 
0011 Kirigami.ApplicationWindow {
0012     id: root
0013 
0014     globalDrawer: Kirigami.GlobalDrawer {
0015         actions: [
0016             Kirigami.Action {
0017                 text: "push"
0018                 onTriggered: pageStack.push(secondPageComponent)
0019             },
0020             Kirigami.Action {
0021                 text: "pop"
0022                 onTriggered: pageStack.pop()
0023             },
0024             Kirigami.Action {
0025                 text: "clear"
0026                 onTriggered: pageStack.clear()
0027             },
0028             Kirigami.Action {
0029                 text: "replace"
0030                 onTriggered: pageStack.replace(secondPageComponent)
0031             }
0032         ]
0033     }
0034 
0035     pageStack.initialPage: mainPageComponent
0036 
0037     Component {
0038         id: mainPageComponent
0039         Kirigami.Page {
0040             title: "First Page"
0041             Rectangle {
0042                 anchors.fill: parent
0043                 QQC2.Label {
0044                     text: "First Page"
0045                 }
0046             }
0047         }
0048     }
0049 
0050     Component {
0051         id: secondPageComponent
0052         Kirigami.Page {
0053             title: "Second Page"
0054             Rectangle {
0055                 color: "red"
0056                 anchors.fill: parent
0057                 QQC2.Label {
0058                     text: "Second Page"
0059                 }
0060             }
0061         }
0062     }
0063 }