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. ListView - The add and remove animations remains sometimes stuck in the middle and leaves artifacts

ListView - The add and remove animations remains sometimes stuck in the middle and leaves artifacts

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
listviewanimationsaddremovestuck
1 Posts 1 Posters 930 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.
  • J Offline
    J Offline
    jeanmilost
    wrote on 24 Nov 2020, 22:44 last edited by
    #1

    I'm working on a project containing a ListView component, and a header allowing to filter the items in the view. To render the display smooth, I also added add and remove animations. However these animations remains sometimes stuck in the middle and leave artifacts, especially when the text in the search area is modified quickly, as you can see on the following screenshot:

    f2b45345-1ecd-40bd-8204-eba180e0ecfd-image.png

    Here is the code I use for the animations:

    /**
    * Animated transition for added item
    */
    add: Transition
    {
        NumberAnimation { property: "m_Height"; from: 0; to: 38; duration: m_TransitionDuration }
    }
    
    /**
    * Animated transition for removed item
    */
    remove: Transition
    {
        NumberAnimation { property: "m_Height"; to: 0; duration: m_TransitionDuration }
    }
    
    /**
    * Animated transition for all items around an added/moved/removed item
    */
    displaced: Transition
    {
        NumberAnimation { property: "y"; duration: m_TransitionDuration; }
    
        // this is required to certify the height animation is well reset to its initial value on displaced
        NumberAnimation { property: "m_Height"; to: 38; }
    }
    

    I know that it's probably a good old and well known issue, but I cannot figure out what I'm doing wrong. According to this document the animation breaks should be handled with the displaced signal:
    https://doc.qt.io/qt-5/qml-qtquick-viewtransition.html#handling-interrupted-animations

    However, and as far as I know, I applied the directives described in this document, but without success. Can someone pointing me what I'm doing wrong?

    NOTE when I disable the above animations in my code, the artifacts no longer appear, so I assume that the issue comes from animations.

    1 Reply Last reply
    0

    1/1

    24 Nov 2020, 22:44

    • Login

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