How to wait until QPropertyAnimation finishes?

  • Hi all

    How can I pause executing program until QPropertyAnimation will finish its work?

    Thanks ahead

  • Why do not you want to do another actions async. when get signal @finished()@ from QPropertyAnimation

  • Please, explain why you want to do that. Maybe you're trying to solve a problem with a wrong solution...

    Well, QPropertyAnimaion uses timers to do its job, so you can't just block qt's main loop or you will not see your animation.

    I would suggest to connect the signal "stateChanged": in your app and detect when your animation starts and when it finishes. With this approach, you can block the components that shouldn't react during the animation.

  • Yes, you are rigth. I just forget I could block component from receiving new events and starting the same animation again. Thanks.

  • ??
    hello all,i use a for loop to move 10 QToolButtons one by one,but they move together in the end,and i don't know why.


    for loop
    for(int i=1;i<=3;i++){
    serialBin = score(temp,x);//Assign a value
    serialNumber = i-1;//Assign a value
    emit mySignal2();//signal

    Some of the variables and the statement
    QPropertyAnimation* theAnimation[10];
    QSignalMapper *m_pSignalMapper;

    connect(theCounts[serialNumber], SIGNAL(clicked()), m_pSignalMapper, SLOT(map()));
    m_pSignalMapper->setMapping(theCounts[serialNumber], QEasingCurve::OutSine);
    connect(m_pSignalMapper, SIGNAL(mapped(int)),this, SLOT(SetAnimation(int)));

    the SetAnimation function
    void MainWindow::SetAnimation(int nCurveType)
    qDebug() << "serialNumber = " << serialNumber;

    theAnimation[serialNumber]->setStartValue(QRect(serialNumber*40,20, 40, 40));


    because the whole project is too large,i don't copy all.
    Who can tell me why?

Log in to reply

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