Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to wait until QPropertyAnimation finishes?
Forum Updated to NodeBB v4.3 + New Features

How to wait until QPropertyAnimation finishes?

Scheduled Pinned Locked Moved General and Desktop
5 Posts 4 Posters 10.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vlad2048
    wrote on last edited by
    #1

    Hi all

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

    Thanks ahead
    Vlad

    1 Reply Last reply
    0
    • A Offline
      A Offline
      alexander
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • D Offline
        D Offline
        danilocesar
        wrote on last edited by
        #3

        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":http://doc.trolltech.com/4.6/qabstractanimation.html#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.

        <a href="http://www.danilocesar.com">Danilo Cesar Lemes de Paula</a>
        Software Engineer

        1 Reply Last reply
        0
        • V Offline
          V Offline
          vlad2048
          wrote on last edited by
          #4

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

          1 Reply Last reply
          0
          • C Offline
            C Offline
            cky050
            wrote on last edited by
            #5

            ??
            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
            QThread::sleep(1);
            }

            /*
            Some of the variables and the statement
            /
            QToolButton
            theCounts[10];
            QPropertyAnimation* theAnimation[10];
            QSignalMapper *m_pSignalMapper;
            ......

            connect(this,SIGNAL(mySignal2()),theCounts[serialNumber],SIGNAL(clicked()));
            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;
            if(theAnimation[serialNumber]->state()==QPropertyAnimation::Running)
            {
            theAnimation[serialNumber]->stop();
            }

            theAnimation[serialNumber]->setDuration(1000);//持续时间
            theAnimation[serialNumber]->setStartValue(QRect(serialNumber*40,20, 40, 40));
            theAnimation[serialNumber]->setEndValue(QRect(width()-400+serialBin*40,height()/2+40,40,40));
            theAnimation[serialNumber]->setEasingCurve(QEasingCurve::Type(nCurveType));
            theAnimation[serialNumber]->start();
            theAnimation[serialNumber]->f
            

            }

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

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved