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 learning how to make Ubuntu Touch OS applications, and I looked all over the web for something, but didn't find any satisfying results. This is either because I am the first to ask this question, or maybe because I am not using the proper vocabulary in my question.

In any case, here's my question.

How do I make an app with a screen that says "Hello World" with a button, and make it so that when I press the button it goes to a different page? By 'page' I mean something like a tab, that isn't listed at the top of the screen, and is attained by clicking a button, not by selecting the tab from the list at the top of the screen.

If my idea is still unclear, consider the System Settings app on Ubuntu Touch. Click on ANYTHING. Wifi, Background, Battery, I literally mean ANYTHING. What happened? You clicked a button and the app displayed a new page. That's what I want to learn how to do.

share|improve this question

1 Answer 1

Tabs {
    id: tabs
    Tab {
        title: i18n.tr("Welcome")
        page: Page {
            Label {
                id: label
                anchors.centerIn: parent
                text: "Welcome To The Premier Duty Gear WebApp for Ubuntu Devices"
            }
            tools: ToolbarItems {
                ToolbarButton {
                    text: "About"
                    onTriggered: print("action triggered")
                }
            }
        }
    }
    Tab {
        id: externalTab
        title: i18n.tr("Web App")
        iconSource: "call_icon.png"
        page: Loader {
            parent: externalTab
            anchors.fill: parent
            source: (tabs.selectedTab === externalTab) ? Qt.resolvedUrl("webapp.qml") : ""

This is a snippet from a webapp i'm working on. You just need to call another qml file. it'll run in the same window.

also do not define window dimensions for the qml filed called or it won't display. It has to use the same dimensions as the parent app.

share|improve this answer
    
Also you can rewrite the code to reflect a click instead of the tab view I used, as I just saw that's what you're trying to get a way from. But the code for both is pretty much the same at the core. –  Jacob Doyelle Yates May 19 at 17:42

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.