How to stop motion of animation



  • hi
    i want to stop motion of my animation when it collides with something by the time. but i doesn't stop
    @ QPropertyAnimation *anim=new QPropertyAnimation(this,"pos");
    anim->setEndValue(QPoint(this->pos().x()+30,0));
    anim->setDuration(1000);
    anim->start();
    if(this->collidesWithItem(_bar))
    {
    anim->stop();
    }@
    in my code when i press one key of keyboard my animation go forward and i want when it collides with something(_bar) it stops but it doesn't occur. why ? please help me and say me how i can stop motion of animation by the time.
    thanks


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.