Pregunta

How can you push a screen on top of a TabbedPane?

I know this is possible with a NavigationPane like below :

NavigationPane {
id: navigationPane
Page {
    Container {
        Label { 
            text: "First page"
        }
    }

    actions: [
        ActionItem {
            title: "Next page"
            onTriggered: {
                var page = pageDefinition.createObject();
                navigationPane.push(page);
attachedObjects: ComponentDefinition {
id: pageDefinition;
source: "secondpage.qml"
    }
  }
 ]
}
...

But I try the same on a TabbedPane and it fails because there is no push method for TabbedPanes.

The scenario is to push an about screen using Application menus.

Help..?

¿Fue útil?

Solución

There is no metaphor for pushing a Tab onto a TabbedPane. If the Tab already exists as a child of the TabbedPane you can make it the active Tab by calling setActiveTab()

If the Tab is not already a child of the TabbedPane you will have to add() it first.

But it sounds like what you really want is a Sheet

Page {
attachedObjects: [
    Sheet {
        id: mySheet
        content: Page {
            Button {
                text: "Close Sheet"
                onClicked: mySheet.close()
            }
        }
    }
]
actions: [
    ActionItem {
        title: "Show Sheet"
        ActionBar.placement: ActionBarPlacement.OnBar
        onTriggered: {
           mySheet.open();
        }
    }
]
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top