How to wait for QPropertyAnimation to finish
-
My goal is to make the following algorithm:
- Compute the result of the rule
- Play an animation
- 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; } -
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. -
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.