diff options
Diffstat (limited to 'examples/widgets/animation/stickman')
-rw-r--r-- | examples/widgets/animation/stickman/lifecycle.cpp | 16 | ||||
-rw-r--r-- | examples/widgets/animation/stickman/stickman.cpp | 2 |
2 files changed, 10 insertions, 8 deletions
diff --git a/examples/widgets/animation/stickman/lifecycle.cpp b/examples/widgets/animation/stickman/lifecycle.cpp index dbe9a299b4..5d4c406b2e 100644 --- a/examples/widgets/animation/stickman/lifecycle.cpp +++ b/examples/widgets/animation/stickman/lifecycle.cpp @@ -61,11 +61,11 @@ class KeyPressTransition: public QSignalTransition { public: KeyPressTransition(GraphicsView *receiver, Qt::Key key) - : QSignalTransition(receiver, SIGNAL(keyPressed(int))), m_key(key) + : QSignalTransition(receiver, &GraphicsView::keyPressed), m_key(key) { } KeyPressTransition(GraphicsView *receiver, Qt::Key key, QAbstractState *target) - : QSignalTransition(receiver, SIGNAL(keyPressed(int))), m_key(key) + : QSignalTransition(receiver, &GraphicsView::keyPressed), m_key(key) { setTargetState(target); } @@ -132,8 +132,10 @@ LifeCycle::LifeCycle(StickMan *stickMan, GraphicsView *keyReceiver) QTimer *timer = new QTimer(lightningBlink); timer->setSingleShot(true); timer->setInterval(100); - QObject::connect(lightningBlink, SIGNAL(entered()), timer, SLOT(start())); - QObject::connect(lightningBlink, SIGNAL(exited()), timer, SLOT(stop())); + QObject::connect(lightningBlink, &QAbstractState::entered, + timer, QOverload<>::of(&QTimer::start)); + QObject::connect(lightningBlink, &QAbstractState::exited, + timer, &QTimer::stop); //! [5] m_dead = new QState(m_machine); @@ -151,7 +153,7 @@ LifeCycle::LifeCycle(StickMan *stickMan, GraphicsView *keyReceiver) // Lightning strikes at random m_alive->addTransition(new LightningStrikesTransition(lightningBlink)); //! [0] - lightningBlink->addTransition(timer, SIGNAL(timeout()), m_dead); + lightningBlink->addTransition(timer, &QTimer::timeout, m_dead); //! [0] m_machine->setInitialState(m_alive); @@ -206,14 +208,14 @@ QState *LifeCycle::makeState(QState *parentState, const QString &animationFileNa topLevel->setInitialState(frameState); else //! [2] - previousState->addTransition(previousState, SIGNAL(propertiesAssigned()), frameState); + previousState->addTransition(previousState, &QState::propertiesAssigned, frameState); //! [2] previousState = frameState; } // Loop - previousState->addTransition(previousState, SIGNAL(propertiesAssigned()), topLevel->initialState()); + previousState->addTransition(previousState, &QState::propertiesAssigned, topLevel->initialState()); return topLevel; diff --git a/examples/widgets/animation/stickman/stickman.cpp b/examples/widgets/animation/stickman/stickman.cpp index b7a2d87ada..8b183d87d5 100644 --- a/examples/widgets/animation/stickman/stickman.cpp +++ b/examples/widgets/animation/stickman/stickman.cpp @@ -126,7 +126,7 @@ StickMan::StickMan() // Set up start position of limbs for (int i=0; i<NodeCount; ++i) { m_nodes[i] = new Node(QPointF(Coords[i * 2], Coords[i * 2 + 1]), this); - connect(m_nodes[i], SIGNAL(positionChanged()), this, SLOT(childPositionChanged())); + connect(m_nodes[i], &Node::positionChanged, this, &StickMan::childPositionChanged); } for (int i=0; i<BoneCount; ++i) { |