WIP: Add gotoPage

This commit is contained in:
Lipu Fei 2019-03-11 15:34:53 +01:00
parent 53ea944da1
commit cc35eb0195
5 changed files with 42 additions and 2 deletions

View file

@ -33,6 +33,7 @@ Item
signal showNextPage()
signal showPreviousPage()
signal passLastPage() // Emitted when there is no more page to show
signal gotoPage(string page_id) // Go to a specific page by the given page_id.
onShowNextPage:
{
@ -53,6 +54,29 @@ Item
}
}
onGotoPage:
{
// find the page index
var page_index = -1
for (var i = 0; i < base.model.count; i++)
{
const item = base.model.getItem(i)
if (item.id == page_id)
{
page_index = i
break
}
}
if (page_index > 0)
{
currentStep = page_index
}
else
{
console.log("Error: cannot find page with page_id = [", page_id, "]")
}
}
onVisibleChanged:
{
if (visible)