Pregunta

I have a class derived from QVariantAnimation and I have to run a code after the finish of the animation.

I tried the signal finished() yet, but there is no emit:

connect(this, SIGNAL(finished()), this, SLOT(setEndVariables()));

Is there any other opinion to see if the animation is stopped, or is the usage of the signal wrong?

Edit: with Code

LiConfigurableFrameAnimation::LiConfigurableFrameAnimation(QString compId, int dur, LiConfigurableFrame *f)
{
    if(dur>0)
        this->setDuration(dur);
    frame=f;
    widget=frame->getComponent(compId);
    isRectMode=false;
    isImageMode=false;

    connect(this, SIGNAL(finished()), this, SLOT(setEndVariables()));
}

Header File:

class LiConfigurableFrameAnimation: public QVariantAnimation
{

    private slots:
        void setEndVariables();

    };
¿Fue útil?

Solución

I solved the problem:

I overload the function updateCurrentTime and check if the current time is equal to the duration.

updateCurrentTime(int curr)
{

    if(curr >= this->duration())....
... 
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top