summaryrefslogtreecommitdiffstats
path: root/examples/animation/stickman
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-08-03 08:35:37 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-08-03 08:40:30 (GMT)
commitacd156649b1083aeeb400fe8fdbbf4e55ada4bed (patch)
treee74b2486cacc4b318b5c0533360ab03e1923a11d /examples/animation/stickman
parent45005c68c6effa41108ef55cd10a84f5977f79a0 (diff)
downloadQt-acd156649b1083aeeb400fe8fdbbf4e55ada4bed.zip
Qt-acd156649b1083aeeb400fe8fdbbf4e55ada4bed.tar.gz
Qt-acd156649b1083aeeb400fe8fdbbf4e55ada4bed.tar.bz2
remove constructors that are not useful
The constructors that take a list of target states produce hard-to-read code, and they're rarely useful in practice since 99% of transitions take a single target state; so it's better to enforce that setTarget{State,States}() be used instead.
Diffstat (limited to 'examples/animation/stickman')
-rw-r--r--examples/animation/stickman/lifecycle.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/examples/animation/stickman/lifecycle.cpp b/examples/animation/stickman/lifecycle.cpp
index c761d87..700916d 100644
--- a/examples/animation/stickman/lifecycle.cpp
+++ b/examples/animation/stickman/lifecycle.cpp
@@ -56,8 +56,9 @@ public:
{
}
KeyPressTransition(GraphicsView *receiver, Qt::Key key, QAbstractState *target)
- : QSignalTransition(receiver, SIGNAL(keyPressed(int)), QList<QAbstractState*>() << target), m_key(key)
+ : QSignalTransition(receiver, SIGNAL(keyPressed(int))), m_key(key)
{
+ setTargetState(target);
}
virtual bool eventTest(QEvent *e)
@@ -78,8 +79,9 @@ class LightningStrikesTransition: public QEventTransition
{
public:
LightningStrikesTransition(QAbstractState *target)
- : QEventTransition(this, QEvent::Timer, QList<QAbstractState*>() << target)
+ : QEventTransition(this, QEvent::Timer)
{
+ setTargetState(target);
qsrand((uint)QDateTime::currentDateTime().toTime_t());
startTimer(1000);
}