PDA

View Full Version : Qml NumberAnimation



IgorP
22nd January 2015, 17:21
Hey,
i wrote 8 puzzle solver in C++ for gui i used QML, it works fine but when i want it to look good and i use NumberAnimation on x,y it looks good when user is moving puzzle but when algorithm is building path it can't keep up and it makes mess. I tried waiting for animation to finish

while(!previousItem->property("animationFinished).toBool){};
moveItem(nextItem); // not actual code
and then move next element but it seems that this freezes whole gui so it never finishes the animation.
Any suggestions?

anda_skoa
22nd January 2015, 18:25
Waiting for the animation to finish is not equivalent to blocking the application, which is what you are doing.

If your application is stuck executing a while loop, it cannot do something else, right?

Provide a slot on an object exported from C++ and call it from QML once the animation is done. Then advance in that slot.

Cheers,
_

IgorP
22nd January 2015, 19:45
While loop was only last thing i tried in despair,
originaly i started with signal and slot but it didn't work so I tried something else,
now i looked at my code with calm head and i realised i emited signal every time running state changed not only when it changed to false,
anyway thank you very much.