Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Autoscroll ListView and animation

Autoscroll ListView and animation

Scheduled Pinned Locked Moved QML and Qt Quick
5 Posts 2 Posters 7.8k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Laipis
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • V Offline
      V Offline
      vsorokin
      wrote on last edited by
      #2

      Try

      @positionViewAtEnd()@

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

      --
      Vasiliy

      1 Reply Last reply
      0
      • L Offline
        L Offline
        Laipis
        wrote on last edited by
        #3

        Thanks! That did the trick.

        1 Reply Last reply
        0
        • L Offline
          L Offline
          Laipis
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0
          • L Offline
            L Offline
            Laipis
            wrote on last edited by
            #5

            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.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved