アニメーションが必要なQStateMachineで無限ループを作成したいと思います。アニメーションのQStateMachineイベントループ
QColor leastTransparent, mostTransparent = color();
leastTransparent.setAlpha(250);
mostTransparent.setAlpha(150);
QState *s1 = new QState();
s1->assignProperty(this, "color", leastTransparent);
QState *s2 = new QState();
s2->assignProperty(this, "color", mostTransparent);
QSignalTransition *transition = s1->addTransition(this, SIGNAL(triggerSignal()),s2);
QSignalTransition *transition2 = s2->addTransition(s2, SIGNAL(entered),s1);
QPropertyAnimation* animation = new QPropertyAnimation(this, "color");
animation->setDuration(5000);
transition->addAnimation(animation);
QPropertyAnimation* animation2 = new QPropertyAnimation(this, "color");
animation2->setDuration(10000);
transition2->addAnimation(animation2);
m_stateMachineAnimation->addState(s1);
m_stateMachineAnimation->addState(s2);
m_stateMachineAnimation->setInitialState(s1);
m_stateMachineAnimation->setGlobalRestorePolicy(QStateMachine::RestoreProperties);
m_stateMachineAnimation->start();
私がここで期待しているのは、「triggerSignal」の後の最初の5秒間に色が不透明になることです。状態は「s2」になります。そして "s2"の入力信号がトリガーされ、10秒間ますます透明になります。
代わりに、私は "triggerSignal"の直後に5秒待ってすぐにs2を起動し、すぐにs1が10秒間待たずに再び起動されるようにしています。
なぜQStateMachineでは時間が考慮されません。 QStateMachineでこのようなアニメーションを実現するにはどうすればいいですか?
あなたは[S.S.C.C.E.](http://www.sscce.org/)を投稿できますか? –