Results 1 to 3 of 3

Thread: Animation problems, after repeated calls to start

  1. #1
    Join Date
    Nov 2010
    Posts
    57
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Animation problems, after repeated calls to start

    I'v set up an animation like this:
    Qt Code:
    1. animate = new QPropertyAnimation(this,"geometry");
    2. animate->setDuration(800);
    3. QEasingCurve curve = QEasingCurve::OutBack;
    4. curve.setOvershoot(1.5);
    5. animate->setEasingCurve(curve);
    6. connect(animate,SIGNAL(finished()),this,SLOT(finishedGeometryAnimation()));
    To copy to clipboard, switch view to plain text mode 

    The startValue and endValue are changed prior to each call to start()
    It all works fine for a while. Then the animation just stops animating.
    According the to object it is running, the state says it is running, but the currentTime never changes from 0 and it also never sends a finished signal.

    Is there something I'm missing with animations?

    To work around this problem I've set up a timer with a duration slightly longer than the animation. If the animation hasn't completed then I force the action I want (move or close). Stop the animation. And call setParent on the animation using the timer event. The next time I call start it animates fine again.

    I also am unable to see any consistence in my testing, sometimes it stops working after six animations, sometimes after an hour of testing.

    Any pointers to what I am doing wrong will be much appreciated.


    Added after 6 minutes:


    Actually, the setParent seems to have stopped working as a solution now.
    Last edited by pan; 9th March 2011 at 08:44.

  2. #2
    Join Date
    Nov 2010
    Posts
    57
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Animation problems, after repeated calls to start

    I hate replying to my own questions... no one got any ideas?

    I've now noticed that all my animations stop working when one stops working... Is there an event blocking them from running? or an event that is not running properly?

  3. #3
    Join Date
    Nov 2010
    Posts
    57
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Animation problems, after repeated calls to start

    In case anyone has a similar problem in the future, I'll note what my problem was:

    I have a lot of widgets and a lot of timers running. But in one of my widgets, which animated, I had a timer which was being started and killed with startTimer and killTimer(int). This timer was being started everytime the widget animated (almost every click of the mouse) and killed between 250 and 500ms later.

    What I discovered, by putting break points in qt's animation code, was that the animation timer had died without my animation telling it to do so, and there was no way of restarting it.

    Removing the timer (very unnecessary code) from my animated widget seems to have fixed the problem. - using singleshot, instead of start and kill, also worked.

    My guess, very wild because I haven't been able to reproduce this in a small application to prove it one way or another, is that I was getting the timerID that was already given to the animation startstoptimer, and my widget was killing this timer, and thus the animation.

Similar Threads

  1. QTabWidget currentChanged signal for repeated selects of a tab
    By balasaravanan in forum Qt Programming
    Replies: 1
    Last Post: 11th January 2011, 06:04
  2. How to use IOCTL calls with QT?
    By augusbas in forum Qt Programming
    Replies: 3
    Last Post: 15th November 2010, 07:55
  3. Replies: 1
    Last Post: 3rd August 2009, 12:44
  4. free/delete calls
    By jcoop in forum Newbie
    Replies: 1
    Last Post: 7th March 2009, 09:04

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.