Autoscroll ListView and animation
-
wrote on 6 Oct 2011, 08:27 last edited by
Hey,
I'm new to QML and I created ListView where I can add items by clicking a button. When several items have been added, I can't see latest item which was added without manually scrolling the list. How can I get the list to follow latest added item?
I tried this: ListView.positionViewAtIndex (1, ListView.End), but it didn't work.
-
wrote on 6 Oct 2011, 08:41 last edited by
Try
@positionViewAtEnd()@
Note: methods should only be called after the Component has completed.
-
wrote on 6 Oct 2011, 08:50 last edited by
Thanks! That did the trick.
-
wrote on 7 Oct 2011, 06:50 last edited by
I continued with the same thread with new problem:
I added SequentialAnimation, where new items smoothly slide from left to it's right position. It works when few items have been added but when more items appear and autoscrolling comes into action, it stops. Animation doesn't start and added items doesn't slide to the list. Any solutions for this?
This is the code I used for animation:
@ListView.onAdd: SequentialAnimation {
NumberAnimation { target: myItem; property: "x"; to: 5; duration: 250}
}@EDIT: Actually when I manually scroll the list, items go to their original position which was before the animation. So they disappear from list.
-
wrote on 12 Oct 2011, 05:58 last edited by
I had to bump this up because I can't figure a solution for this. Seems like that any change that I make for ListView's items, they return to their original form when scrolling the listview.
For example, I add several items to list. These items are rectangles which are aligned to the left side of the list. I push a button which changes rectangles alignment to right side of the list. It does that, but then I scroll up and down the list and each rectangle goes to original position: left side of the list.
5/5