[SOLVED] listview with 2 models and back button
-
i have 2 listviews
1 list view that is an ICON menu
!http://img220.imageshack.us/img220/8147/step1s.png(Click to see the first listview)!
and the clicked code is
@ function iconClicked() {
subMenuModel.iName = iName
screen.iName = iName
screen.iSource = iSource
previousMenu.append({"name": iName}) //add for the back button
}@then once its clicked
!http://img254.imageshack.us/img254/3551/step2xf.png(Click to see second listview)!
and the clicked code for that is
@ function iconClicked() {
screen.iName = sName
screen.iSource = sSource
subMenuModel.iName = iName
previousMenu.append({"name": sName}) //add for the back button
}@and previousMenu has what ever you clicked on currently so if you clicked on store 1 thats what would append now i want to be able to click my back button but onClicked get the size of the list go to the last one delete and read the text if the back button is clicked again get the new size of the list then read the text of the last one in the list
how would i do such thing ?
-
Edit: i solved my issue with a back button for anyone else wanting to know how i fixed this was
@
ListModel {
id: itemModel
function itemRequested(item)
{
append({"item": item})
menuModel.topLevelName = item
}
function itemLast()
{
if (count != 0)
remove(count - 1)if (count - 1 <= 0) { toolBar.activateBack = true } if (count != 0) { var itemName = get(count - 1).item contentZone.sendData2model = itemName } } }
@
when items are clicked @ itemModel.itemRequested(myString)@
and when the back buttin is clicked @itemModel.itemLast()@