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 for QPropertyAnimation to finish
Forum Updated to NodeBB v4.3 + New Features

How to wait for QPropertyAnimation to finish

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 498 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.
  • - Offline
    - Offline
    -GSG-
    wrote on last edited by
    #1

    My goal is to make the following algorithm:

    1. Compute the result of the rule
    2. Play an animation
    3. After the animation has been played -> go to the next rule

    I can't figure out how to implement the waiting from (2) -> (3)

    here is the algorithm:

    while (running) {
        doRule(CurrentRow, CurrentCol, 1, running);
        currentPosition = getPointer();
    
        movingArrow = new QPropertyAnimation(ui->arrow, "geometry");
        movingArrow->setDuration(125 * arrowSpeed);
        movingArrow->setStartValue(arrowPos(lastPosition));
        movingArrow->setEndValue(arrowPos(currentPosition));
        movingArrow->start();
    
        QObject::connect(movingArrow, &QPropertyAnimation::finished,
                         this, &TuringWindow::deleteAnimation);
    
        lastPosition = currentPosition;
    }
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Use the finished signal of QPropertyAnimation to trigger the execution of the text rule.
      No need for such a tight loop.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      - 1 Reply Last reply
      3
      • SGaistS SGaist

        Hi and welcome to devnet,

        Use the finished signal of QPropertyAnimation to trigger the execution of the text rule.
        No need for such a tight loop.

        - Offline
        - Offline
        -GSG-
        wrote on last edited by
        #3

        @SGaist Thanks, it worked. I got rid of the while loop and connected the finished signal of QPropertyAnimation to the function of running the programm which runs the rules.

        1 Reply Last reply
        1

        • Login

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