RibbonTabBar: Add setPage func.

This commit is contained in:
Mentalflow 2024-05-08 09:32:59 +08:00
parent 38d5ca8d89
commit 300d93e2bc
Signed by: Mentalflow
GPG Key ID: 5AE68D4401A2EE71
1 changed files with 16 additions and 1 deletions

View File

@ -90,7 +90,6 @@ Item{
left: parent.left left: parent.left
right:tool_bar.left right:tool_bar.left
} }
background: Item{} background: Item{}
position: TabBar.Header position: TabBar.Header
currentIndex: stack.currentIndex currentIndex: stack.currentIndex
@ -299,4 +298,20 @@ Item{
timer.start() timer.start()
} }
} }
function setPage(index)
{
for (let i=0, count = 0; i < bar.contentChildren.length; i++)
{
let item = bar.itemAt(i)
if(item instanceof RibbonTabButton){
if (count === index)
{
item.checked = true
break
}
count++
}
}
}
} }