Search code examples
c++qt4.7qpropertyanimation

QPropertyAnimation modifying interval


I'm using a QPropertyAnimation object to move some controls in the following way:

    QPropertyAnimation* animation = new QPropertyAnimation(message_, "pos");
    animation->setDuration(2000);
    animation->setStartValue(current_pos);
    animation->setEndValue(new_pos); 
    animation->setEasingCurve(QEasingCurve::Linear);
    animation->start(QAbstractAnimation::DeleteWhenStopped);

    asl::checkedConnect(animation, SIGNAL(finished()), this, SLOT(slotScrollingFinished()));

The object works AFAIK by executing every few milliseconds and modifying the value of the pos property until the duration expires and the end value is reached.

I was wondering if there is a way to modify the internal QPropertyAnimation object's interval timer to change the amount of times it will access the pos property within this 2 second duration.

I can't see anything in the docs.


Solution

  • You can do this:

    #include <qt/src/corelib/animation/qabstractanimation_p.h>
    
    QUnifiedTimer::instance()->setTimingInterval(new_interval);