ListView contentY problem
In my QML app I have a ListView populated from a model. Each delegate in the ListView is a button which moves you to a new screen. I save the ListView's contentY property so that when the user moves back, he/she can be at the same point in the list as when he left it.
The problem is that, if this point is some way down the list, there is a pause to move there, because the ListView instantiates each delegate until that point is reached.
In a list with many delegates this causes a noticeable slow-down.
I guess this happens because the system doesn't know what height each delegate is, so it has to instantiate each one to figure out which delegate is at the given Y co-ordinate.
Is there a way round this? e.g. to specify a fixed height for each delegate? Or to give delegates a way to return their height without instantiating themselves (Cocoa Touch's ListView equivalent, I forget what it is called, offers both of these).
I thought there was something like an "averageItemHeight" property (or something along those lines), but I can not find it anymore, so I might have been mistaken on that. Does it help if you set the contentHeight property explicitly to the height of your delegate * the number of items in your list?
You should be able to use ListView's "positionViewAtIndex()":http://doc.qt.nokia.com/4.7/qml-listview.html#positionViewAtIndex-method function for this.
Edit: fixed URL (Andre)
I also have listViews that I use in an app I am developing. It also goes to a different page when an item is clicked. The strange thing is, when I go back, it is already in the place I left it, without using any other programming like Y position or what not. My question is are you making it load the listview over and over again. When I move away from my list I just make that list view visible: false. For me that keeps the list where it was and when I go back the visible: true just makes it seen again. If there is no need to repopulate the list then this should solve your problem.