Autoscroll ListView and animation

  • 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.

  • Try


    Note: methods should only be called after the Component has completed.

  • Thanks! That did the trick.

  • 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.

  • 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.

Log in to reply