Solved QStateMachine animation with QFinalState, bug?
-
Sorry I don't understand your question.
What "condition" you mean?m_pSS - it's initial state (m_slide_mashine->setInitialState(m_pSS);)
then after assignProperty() I do m_slide_mashine->start(); -
I mean that with that line for example:
m_pSS->addTransition(m_pFS);
as soon as your state machine enters them_pSS
state it will go to them_pFS
state hence your animation not working as you expect. Thus my question, shouldn't you have a condition to transition fromm_pSS
tom_pFS
? For example a mouse click, number of animation repetition etc. -
Oh, understand! :-)
No condition is not required.
And sorry for my mistake in first post, when i said "animation is not working" I mean that after call m_slide_mashine->start() we immediately go from m_pSS -> m_pFS -> QFinalState (i.e. without duration) , but when I do not use QFinalState animation work as expected (with duration as I set in pAni->setDuration() ). -
It happens precisely because you didn't put any condition for the transition between the two states. If you take a look at the Simple State Machine example, the condition to change state is a mouse click.
So you have to determine what should trigger the transition between
m_pSS
andm_pFS
and use the adequate QAbstractTransition subclass. -
Sorry but I don't understand again.
Why I need "condition" when API allow do that without it?
And why animation is broken only when I try to use QFinalState? -
The animation is not broken.
Like I already wrote:
m_pSS->addTransition(m_pFS);
means that as soon as your state machine enters them_pSS
state it will transition tom_pFS
thus the state machine will stop since it's a final state. -
I understand.
Thank you! -
You're welcome !
So you could make it work the way you wanted ?
-
Yes. Thank you!
-
Great !
You'r welcome !
Since you have it working now, please mark the thread as solved using the "Topic Tools" button so that other forum users may know a solution has been found :)