AusweisApp2/resources/qml/TabBarView.qml

70 lines
1.3 KiB
QML
Raw Normal View History

2017-07-03 09:30:10 +02:00
import QtQuick 2.5
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.2
import "global"
Item {
id: baseItem
property string source
property alias stack: stack
// Item provided by loader has been pushed
property bool pushed: false
// Items that should be pushed after the main item has been loaded and pushed
property var pendingItems: []
Loader {
id: loader
asynchronous: true
onLoaded: {
2017-07-03 09:33:28 +02:00
appWindow.hideSplashScreen()
2017-07-03 09:30:10 +02:00
baseItem.pushed = true
push(item)
for (var i = 0; i < baseItem.pendingItems.length; i++) {
var pendingItem = baseItem.pendingItems[i]
push(pendingItem["item"], pendingItem["properties"])
}
baseItem.pendingItems = []
2017-07-03 09:33:28 +02:00
numberModel.continueWorkflow()
2017-07-03 09:30:10 +02:00
}
source: parent.visible ? parent.source : loader.source
}
onVisibleChanged: {
if (visible) {
titleBar.pushTabBarSubView(stack.currentItem)
}
}
StackView {
id: stack
anchors.fill: parent
onCurrentItemChanged: {
titleBar.pushTabBarSubView(currentItem)
}
}
function push(sectionPage, properties) {
if (baseItem.pushed) {
stack.push(sectionPage, properties)
}
// Main item has not been loaded yet, delay push.
else {
baseItem.pendingItems.push({ "item": sectionPage, "properties": properties })
}
}
function pop(item) {
stack.pop(item)
}
}