Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm writing an app using the Ubuntu SDK, and I've got a PageStack component inside aTabs component.

When I load one of the pages inside the PageStack, it all works well, and in the header the name of the current tab is shown. However, if when the Page is open instead of hitting the Back button from the toolbar I choose another tab, it totally confuses the toolbar, which then no longer shows the Back button.

Is there a way to make my pages full screen, so that the header with the name of the current tab is not shown (and thus cannot be tapped), or even better, to show the title of the current page in the header instead of the parent tab title?

Tabs {
    id: tabs

    Tab {
            objectName: "tabQreator"
            title: i18n.tr("Create")
            page: CreatorPage {
                id: pageCreator
            }
    }

    // ...
}

And on CreatorPage.qml:

PageStack {
    id: pageStack

    anchors {
        fill: parent
    }

    Component.onCompleted: push(pageRoot)

    Page {
        id: somePage

        // Toolbar definition here...
    }

    Page {
        id: pageRoot
        title: i18n.tr("The root page")
        visible: false
        // ...

    }
share|improve this question

2 Answers 2

Credit goes to Szymon Waliczek, who answered this on G+. The following snippet hides the header on all Pages except for the root page.

PageStack {
    id: pageStack

    onCurrentPageChanged: {
        if(pageStack.currentPage === pageRoot) {
            // mainview is the MainView's id
            mainview.header.visible = true
            mainview.header.show()
        } else {
            mainview.header.hide()
            mainview.header.visible = false
        };
    }
}

This works like a charm, although the toolbar still gets confused and is shown on the root page, where it's not even defined.

Any ideas on how to further refine this and instead of hiding the header, show the current Page's title instead of that of the parent Tab?

share|improve this answer

Actually, while the other answer is valid for the original question, the best way is to do it the other way around and nest the Tabs inside a PageStack, as described on this other question.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.