Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

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":http://www.qtcentre.org/archive/index.php/t-40680.html?s=3e249e34a7442da1d062a550aecade69)

    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":http://dl.dropbox.com/u/2346027/abstractitemmodel.zip

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


Log in to reply