Please nominate your Qt Champions for 2021!

Animation does not finish when slot is called in onRunningChanged

  • I've got a GridView which shows 9 items at once.
    When a MouseArea is clicked, the next 9 items should be shown. I've got this animation:
    NumberAnimation { id: anim; target: gridview; property: "contentX"; duration: 500; onRunningChanged: if(!running) {console.log("contx: " + gridview.contentX); myModel.mySlot()} }
    (I got the code for the animation from here: "Animate ListView positionViewAtIndex":

    The animation is working fine when I don't call myModel.mySlot().

    When I call this slot (it just sleeps for 1000 ms in the example code), it seems that the animation does not finish. Then the view jumps a bit to position the view correctly.

    Here is a link to my project (it is a modified version of the abstractitemmodel example): "zip file":

    Can somebody tell me what I'm doing wrong? I'm using Qt 4.8. Thank you!

Log in to reply