diff options
author | Kent Hansen <khansen@trolltech.com> | 2009-04-24 11:58:57 +0200 |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-04-24 11:58:57 +0200 |
commit | dfe6974c1e7103ad46fa1162d7c9fd6a426894b7 (patch) | |
tree | 94b0475734945c9de24a472f70c3bedcd485aee6 /examples/animation/stickman/lifecycle.cpp | |
parent | 686f82e51124747cbe650d04dfb053830b6660fa (diff) | |
parent | 221ec8dae1b247d5f8fb03d947d13cb6541a5805 (diff) | |
download | qt4-tools-dfe6974c1e7103ad46fa1162d7c9fd6a426894b7.tar.gz |
Merge branch 'kinetic-statemachine' into kinetic-animations
Conflicts:
examples/animation/piemenu/qgraphicspiemenu_p.h
Diffstat (limited to 'examples/animation/stickman/lifecycle.cpp')
-rw-r--r-- | examples/animation/stickman/lifecycle.cpp | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/examples/animation/stickman/lifecycle.cpp b/examples/animation/stickman/lifecycle.cpp index 4f2ac6dadc..df69d471c3 100644 --- a/examples/animation/stickman/lifecycle.cpp +++ b/examples/animation/stickman/lifecycle.cpp @@ -111,14 +111,12 @@ LifeCycle::LifeCycle(StickMan *stickMan, GraphicsView *keyReceiver) // Set up intial state graph m_machine = new QStateMachine(); - m_machine->setGlobalRestorePolicy(QState::RestoreProperties); m_alive = new QState(m_machine->rootState()); m_alive->setObjectName("alive"); // Make it blink when lightning strikes before entering dead animation QState *lightningBlink = new QState(m_machine->rootState()); - lightningBlink->setRestorePolicy(QState::DoNotRestoreProperties); lightningBlink->assignProperty(m_stickMan->scene(), "backgroundBrush", Qt::white); lightningBlink->assignProperty(m_stickMan, "penColor", Qt::black); lightningBlink->assignProperty(m_stickMan, "fillColor", Qt::white); @@ -127,11 +125,10 @@ LifeCycle::LifeCycle(StickMan *stickMan, GraphicsView *keyReceiver) QTimer *timer = new QTimer(lightningBlink); timer->setSingleShot(true); timer->setInterval(100); - lightningBlink->invokeMethodOnEntry(timer, "start"); - lightningBlink->invokeMethodOnExit(timer, "stop"); + QObject::connect(lightningBlink, SIGNAL(entered()), timer, SLOT(start())); + QObject::connect(lightningBlink, SIGNAL(exited()), timer, SLOT(stop())); m_dead = new QState(m_machine->rootState()); - m_dead->setRestorePolicy(QState::DoNotRestoreProperties); m_dead->assignProperty(m_stickMan->scene(), "backgroundBrush", Qt::black); m_dead->assignProperty(m_stickMan, "penColor", Qt::white); m_dead->assignProperty(m_stickMan, "fillColor", Qt::black); @@ -151,15 +148,6 @@ LifeCycle::LifeCycle(StickMan *stickMan, GraphicsView *keyReceiver) m_machine->setInitialState(m_alive); } -void LifeCycle::setResetKey(Qt::Key resetKey) -{ - // When resetKey is pressed, enter the idle state and do a restoration animation - // (requires no animation pointer, since no property is being set in the idle state) - KeyPressTransition *trans = new KeyPressTransition(m_keyReceiver, resetKey, m_idle); - trans->addAnimation(m_animationGroup); - m_alive->addTransition(trans); -} - void LifeCycle::setDeathAnimation(const QString &fileName) { QState *deathAnimation = makeState(m_dead, fileName); |