Advertisement
Guest User

Untitled

a guest
Aug 16th, 2017
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QML 1.37 KB | None | 0 0
  1. import QtQuick 2.7
  2. import QtQuick.Controls 2.0
  3. import QtQuick.Layouts 1.3
  4.  
  5. ApplicationWindow {
  6.     visible: true
  7.     width: 640
  8.     height: 480
  9.     title: qsTr("Hello World")
  10.  
  11.     StackView {
  12.         id: swipeView
  13.         anchors.fill: parent
  14.  
  15.         initialItem: Component {
  16.             id: main
  17.  
  18.             Page {
  19.                 Text {
  20.                     text: qsTr("Hello main")
  21.                     anchors.centerIn: parent
  22.                 }
  23.             }
  24.         }
  25.     }
  26.  
  27.     Component {
  28.         id: testComponent
  29.  
  30.         Loader {
  31.             property string custom
  32.  
  33.             sourceComponent: pageComp
  34.  
  35.             active: StackView.status != StackView.Inactive
  36.         }
  37.     }
  38.  
  39.     Component {
  40.         id: pageComp
  41.  
  42.         Page {
  43.             id: page
  44.             property string innerProp: custom
  45.  
  46.             Text {
  47.                 text: page.innerProp
  48.                 anchors.centerIn: parent
  49.             }
  50.         }
  51.     }
  52.  
  53.     footer: TabBar {
  54.         id: tabBar
  55.         TabButton {
  56.             text: qsTr("Add")
  57.             onClicked: {
  58.                 swipeView.push(testComponent,{"custom":"Custom text"})
  59.             }
  60.         }
  61.         TabButton {
  62.             text: qsTr("remove")
  63.             enabled: swipeView.depth > 1
  64.             onClicked: {
  65.                 swipeView.pop()
  66.             }
  67.         }
  68.     }
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement