-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathPageStack.qml
65 lines (55 loc) · 1.69 KB
/
PageStack.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import QtQuick 2.0
Item {
id: pageStack
property var stack: []
property Page currentItem: null
property Page currentPage: currentTabs ? currentTabs.selectedPage : currentItem
property Tabs currentTabs: currentItem && currentItem.hasOwnProperty("selectedPage") ? currentItem : null
property int count: stack.length
function open(page, caller, args) {
print(typeof(page))
if (typeof(page) == "string") {
page = newObject(page, args)
if (page === null)
return
page.dynamic = true
} else if (String(page).indexOf("QQmlComponent") == 0) {
page = page.createObject(app, args);
if (page === null)
return
page.dynamic = true
}
page.open(caller)
}
function push(page, args) {
print(typeof(page), page)
if (typeof(page) == "string") {
page = newObject(page, args)
if (page === null)
return
page.dynamic = true
} else if (String(page).indexOf("QQmlComponent") == 0) {
page = page.createObject(app, args);
if (page === null)
return
page.dynamic = true
}
page.parent = pageStack
stack.push(currentItem)
stack = stack
currentItem = page
if (count > 1) {
navbar.transitionToPage(page)
page.push()
} else {
navbar.loadInitialPage(page)
page.init()
}
}
function pop() {
currentItem.pop()
currentItem = stack.pop()
stack = stack
navbar.transitionBackToPage(currentItem)
}
}