View Single Post
marxian's Avatar
Posts: 2,448 | Thanked: 9,523 times | Joined on Aug 2010 @ Wigan, UK
#27
StatusBar, Menu, and PageStack are now independent components, so they can be used outside of PageStackWindow. There is also a new ApplicationWindow component.

Code:
ApplicationWindow {
    id: appWindow

    StatusBar {
        id: statusBar

        property string backPressedState: backButtonPressed ? "Pressed" : ""

        anchors {
            top: parent.top
            left: parent.left
            right: parent.right
        }

        titleText: pageStack.currentPage === null ? "" : pageStack.currentPage.title
        showMenuIndicator: (pageStack.currentPage !== null) && (pageStack.currentPage.tools !== null)
        backButtonIconSource: (pageStack === null) || (pageStack.depth === 1) ? "image://theme/wmCloseIcon" + backPressedState : "image://theme/wmBackIcon" + backPressedState
        onTitleAreaClicked: menu.open()
        onBackClicked: (pageStack === null) || (pageStack.depth === 1) ? Qt.quit() : pageStack.pop()
        onBackPressAndHold: if ((pageStack !== null) && (pageStack.depth > 1)) pageStack.pop(null);
    }

    PageStack {
        id: pageStack

        anchors {
            top: statusBar.bottom
            left: parent.left
            right: parent.right
            bottom: parent.bottom
        }

        Component.onCompleted: push(Qt.resolvedUrl("HomePage.qml"), null, true)
    }

    Menu {
        id: menu

        tools: pageStack.currentPage === null ? null : pageStack.currentPage.tools
    }
}
__________________
'Men of high position are allowed, by a special act of grace, to accomodate their reasoning to the answer they need. Logic is only required in those of lesser rank.' - J K Galbraith

My website

GitHub
 

The Following 4 Users Say Thank You to marxian For This Useful Post: