QPropertyAnimation modifying interval

517 Views Asked by At

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.

1

There are 1 best solutions below

1
kh25 On BEST ANSWER

You can do this:

#include <qt/src/corelib/animation/qabstractanimation_p.h>

QUnifiedTimer::instance()->setTimingInterval(new_interval);