summaryrefslogtreecommitdiffstats
path: root/examples/animation
diff options
context:
space:
mode:
Diffstat (limited to 'examples/animation')
-rw-r--r--examples/animation/appchooser/main.cpp2
-rw-r--r--examples/animation/example/mainwindow.cpp6
-rw-r--r--examples/animation/moveblocks/main.cpp2
-rw-r--r--examples/animation/stickman/lifecycle.cpp16
-rw-r--r--examples/animation/stickman/lifecycle.h1
-rw-r--r--examples/animation/stickman/main.cpp2
6 files changed, 7 insertions, 22 deletions
diff --git a/examples/animation/appchooser/main.cpp b/examples/animation/appchooser/main.cpp
index 7573347..02302d9 100644
--- a/examples/animation/appchooser/main.cpp
+++ b/examples/animation/appchooser/main.cpp
@@ -134,7 +134,7 @@ int main(int argc, char **argv)
window.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
QStateMachine machine;
- machine.setGlobalRestorePolicy(QState::RestoreProperties);
+ machine.setGlobalRestorePolicy(QStateMachine::RestoreProperties);
QState *group = new QState(machine.rootState());
group->setObjectName("group");
diff --git a/examples/animation/example/mainwindow.cpp b/examples/animation/example/mainwindow.cpp
index 3770513..4aff384 100644
--- a/examples/animation/example/mainwindow.cpp
+++ b/examples/animation/example/mainwindow.cpp
@@ -203,9 +203,9 @@ MainWindow::MainWindow() : QMainWindow(0)
setCentralWidget(view);
- state3->invokeMethodOnEntry(this, "onEnterState3");
- state2->invokeMethodOnEntry(this, "onEnterState2");
- state1->invokeMethodOnEntry(this, "onEnterState1");
+ QObject::connect(state3, SIGNAL(entered()), this, SLOT(onEnterState3()));
+ QObject::connect(state2, SIGNAL(entered()), this, SLOT(onEnterState2()));
+ QObject::connect(state1, SIGNAL(entered()), this, SLOT(onEnterState1()));
connect(listWidget, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(onItemClicked(QListWidgetItem*)));
connect(button3, SIGNAL(clicked()), this, SLOT(onRemoveClicked()));
diff --git a/examples/animation/moveblocks/main.cpp b/examples/animation/moveblocks/main.cpp
index 076da59..eb23bd5 100644
--- a/examples/animation/moveblocks/main.cpp
+++ b/examples/animation/moveblocks/main.cpp
@@ -202,7 +202,7 @@ int main(int argc, char **argv)
QTimer timer;
timer.setInterval(1250);
timer.setSingleShot(true);
- group->invokeMethodOnEntry(&timer, "start");
+ QObject::connect(group, SIGNAL(entered()), &timer, SLOT(start()));
QState *state1;
QState *state2;
diff --git a/examples/animation/stickman/lifecycle.cpp b/examples/animation/stickman/lifecycle.cpp
index 4f2ac6d..df69d47 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);
diff --git a/examples/animation/stickman/lifecycle.h b/examples/animation/stickman/lifecycle.h
index 4ca6ffd..e520402 100644
--- a/examples/animation/stickman/lifecycle.h
+++ b/examples/animation/stickman/lifecycle.h
@@ -58,7 +58,6 @@ public:
~LifeCycle();
void setDeathAnimation(const QString &fileName);
- void setResetKey(Qt::Key key);
void addActivity(const QString &fileName, Qt::Key key);
void start();
diff --git a/examples/animation/stickman/main.cpp b/examples/animation/stickman/main.cpp
index 6ff437d..62d8252 100644
--- a/examples/animation/stickman/main.cpp
+++ b/examples/animation/stickman/main.cpp
@@ -64,7 +64,6 @@ int main(int argc, char **argv)
"<li>Press <font color=\"purple\">J</font> to make the stickman jump.</li>"
"<li>Press <font color=\"purple\">D</font> to make the stickman dance.</li>"
"<li>Press <font color=\"purple\">C</font> to make him chill out.</li>"
- "<li>Press <font color=\"purple\">Return</font> to make him return to his original position.</li>"
"<li>When you are done, press <font color=\"purple\">Escape</font>.</li>"
"</i></p>"
"<p>If he is unlucky, the stickman will get struck by lightning, and never jump, dance or chill out again."
@@ -87,7 +86,6 @@ int main(int argc, char **argv)
view->setSceneRect(scene->sceneRect());
LifeCycle *cycle = new LifeCycle(stickMan, view);
- cycle->setResetKey(Qt::Key_Return);
cycle->setDeathAnimation("animations/dead");
cycle->addActivity("animations/jumping", Qt::Key_J);