So in a previous question I tried to use the Ubuntu UI Toolkit to nest a PageStack within the Tabs component. It seemed to work, but it had its quirks, so I'm now trying another option, which in theory should have the same effect according to the documentation.
However, with the code below, I've noticed the following: upon opening page3, if I then pull the toolbar and tap on the Back button, it always returns me to to the initial Tab in Tabs, instead of the actual tab that the page was loaded from.
That is, page3
is loaded from tab2
, but if I open the page, pull the toolbar from the bottom and hit Back, I'm returned to tab1
instead.
How can I make it so that tapping Back returns me to tab2
?
import QtQuick 2.0
import Ubuntu.Components 1.1
MainView {
id: mainView
width: units.gu(38)
height: units.gu(50)
PageStack {
id: pageStack
Component.onCompleted: push(tabs)
Tabs {
id: tabs
Tab {
id: tab1
title: "Tab 1"
page: Page {
Label {
anchors.centerIn: parent
text: "Use header to navigate between tabs"
}
}
}
Tab {
id: tab2
title: "Tab 2"
page: Page {
Button {
anchors.centerIn: parent
onClicked: pageStack.push(page3)
text: "Press"
}
}
}
}
Page {
id: page3
visible: false
title: "Page on stack"
Label {
anchors.centerIn: parent
text: "Press back to return to the tabs"
}
}
}
}
Best Answer
This is due to a bug recently introduced into the UI Toolkit: https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1316736
Once that is fixed, it will once again return you to the previously selected tab when going back to the Tabs page of a PageStack.