~nskaggs/+junk/pagestack-push

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
import QtQuick 2.0
import Ubuntu.Components 0.1
import Ubuntu.Components.Popups 0.1
import QtQuick.Window 2.0

MainView {
    id: mainView
    useDeprecatedToolbar: false

    width: units.gu(100)
    height: units.gu(80)
    focus: true

    PageStack {
        id: pageStack

        Component.onCompleted: push(tabs)

        Tabs{
            id: tabs

            ToolbarItems {
                id: commonToolBar

                ToolbarButton {
                    action: Action {
                        iconSource: Qt.resolvedUrl("cancel.svg");
                        text: i18n.tr("Dummy Button");
                    }
                }
                ToolbarButton {
                    action: Action {
                        objectName: "textfieldpagebutton"
                        iconSource: Qt.resolvedUrl("cancel.svg");
                        text: i18n.tr("Click Me!");
                        onTriggered: {
                            pageStack.push(Qt.resolvedUrl("textfield_page.qml"));
                        }
                    }
                }
                ToolbarButton {
                    action: Action {
                        iconSource: Qt.resolvedUrl("cancel.svg");
                        text: i18n.tr("Another Dummy Button");
                    }
                }
            }

            Tab{
                id: pageTab
                objectName: "PageTab"
                title: i18n.tr("Blank Page")
                page: Loader{
                    id: pageLoader
                    objectName: "page"
                    source: Qt.resolvedUrl("page.qml")
                    onLoaded: {
                        item.tools = Qt.binding(function() { return commonToolBar })
                    }
                }
            }
        }
    }
}