summaryrefslogtreecommitdiffstats
path: root/examples/widgets/animation
diff options
context:
space:
mode:
authorChristian Ehrlicher <ch.ehrlicher@gmx.de>2018-12-07 14:15:36 +0100
committerChristian Ehrlicher <ch.ehrlicher@gmx.de>2019-01-06 17:08:03 +0000
commit8cf812231405e011b422a1505d9a219618fe5cee (patch)
tree99603ff6fd301dfbdc8104fd0b470d3b9aa3262c /examples/widgets/animation
parentcf27d9e8a5e14ebe083f4b0fa2204d0646e7ed5e (diff)
Cleanup Widgets examples - new signal/slot syntax
Cleanup the Widget examples - use the new signal/slot syntax where possible - animation, effects and graphicsview subdirectory Change-Id: I6cbaea6e628eb06f8e0ca6a0b795030a66b83878 Reviewed-by: Luca Beldi <v.ronin@yahoo.it> Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io>
Diffstat (limited to 'examples/widgets/animation')
-rw-r--r--examples/widgets/animation/easing/window.cpp15
-rw-r--r--examples/widgets/animation/moveblocks/main.cpp4
-rw-r--r--examples/widgets/animation/states/main.cpp6
-rw-r--r--examples/widgets/animation/stickman/lifecycle.cpp16
-rw-r--r--examples/widgets/animation/stickman/stickman.cpp2
-rw-r--r--examples/widgets/animation/sub-attaq/animationmanager.cpp4
-rw-r--r--examples/widgets/animation/sub-attaq/boat.cpp10
-rw-r--r--examples/widgets/animation/sub-attaq/bomb.cpp10
-rw-r--r--examples/widgets/animation/sub-attaq/graphicsscene.cpp18
-rw-r--r--examples/widgets/animation/sub-attaq/qanimationstate.cpp6
-rw-r--r--examples/widgets/animation/sub-attaq/states.cpp12
-rw-r--r--examples/widgets/animation/sub-attaq/submarine.cpp12
-rw-r--r--examples/widgets/animation/sub-attaq/submarine_p.h3
-rw-r--r--examples/widgets/animation/sub-attaq/torpedo.cpp10
14 files changed, 68 insertions, 60 deletions
diff --git a/examples/widgets/animation/easing/window.cpp b/examples/widgets/animation/easing/window.cpp
index 8c03e0534d..aa12147388 100644
--- a/examples/widgets/animation/easing/window.cpp
+++ b/examples/widgets/animation/easing/window.cpp
@@ -66,11 +66,16 @@ Window::Window(QWidget *parent)
m_ui.amplitudeSpinBox->setValue(dummy.amplitude());
m_ui.overshootSpinBox->setValue(dummy.overshoot());
- connect(m_ui.easingCurvePicker, SIGNAL(currentRowChanged(int)), this, SLOT(curveChanged(int)));
- connect(buttonGroup, SIGNAL(buttonClicked(int)), this, SLOT(pathChanged(int)));
- connect(m_ui.periodSpinBox, SIGNAL(valueChanged(double)), this, SLOT(periodChanged(double)));
- connect(m_ui.amplitudeSpinBox, SIGNAL(valueChanged(double)), this, SLOT(amplitudeChanged(double)));
- connect(m_ui.overshootSpinBox, SIGNAL(valueChanged(double)), this, SLOT(overshootChanged(double)));
+ connect(m_ui.easingCurvePicker, &QListWidget::currentRowChanged,
+ this, &Window::curveChanged);
+ connect(buttonGroup, QOverload<int>::of(&QButtonGroup::buttonClicked),
+ this, &Window::pathChanged);
+ connect(m_ui.periodSpinBox, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
+ this, &Window::periodChanged);
+ connect(m_ui.amplitudeSpinBox, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
+ this, &Window::amplitudeChanged);
+ connect(m_ui.overshootSpinBox, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
+ this, &Window::overshootChanged);
createCurveIcons();
QPixmap pix(QLatin1String(":/images/qt-logo.png"));
diff --git a/examples/widgets/animation/moveblocks/main.cpp b/examples/widgets/animation/moveblocks/main.cpp
index 6d17696108..e59b17cbf9 100644
--- a/examples/widgets/animation/moveblocks/main.cpp
+++ b/examples/widgets/animation/moveblocks/main.cpp
@@ -214,7 +214,7 @@ int main(int argc, char **argv)
QTimer timer;
timer.setInterval(1250);
timer.setSingleShot(true);
- QObject::connect(group, SIGNAL(entered()), &timer, SLOT(start()));
+ QObject::connect(group, &QState::entered, &timer, QOverload<>::of(&QTimer::start));
//![2]
//![3]
@@ -302,7 +302,7 @@ int main(int argc, char **argv)
//![7]
StateSwitcher *stateSwitcher = new StateSwitcher(&machine);
stateSwitcher->setObjectName("stateSwitcher");
- group->addTransition(&timer, SIGNAL(timeout()), stateSwitcher);
+ group->addTransition(&timer, &QTimer::timeout, stateSwitcher);
stateSwitcher->addState(state1, &animationGroup);
stateSwitcher->addState(state2, &animationGroup);
//![7]
diff --git a/examples/widgets/animation/states/main.cpp b/examples/widgets/animation/states/main.cpp
index 14d193c301..0f61b7457a 100644
--- a/examples/widgets/animation/states/main.cpp
+++ b/examples/widgets/animation/states/main.cpp
@@ -214,7 +214,7 @@ int main(int argc, char *argv[])
state3->assignProperty(p5, "opacity", qreal(1));
state3->assignProperty(p6, "opacity", qreal(1));
- QAbstractTransition *t1 = state1->addTransition(button, SIGNAL(clicked()), state2);
+ QAbstractTransition *t1 = state1->addTransition(button, &QAbstractButton::clicked, state2);
QSequentialAnimationGroup *animation1SubGroup = new QSequentialAnimationGroup;
animation1SubGroup->addPause(250);
animation1SubGroup->addAnimation(new QPropertyAnimation(box, "geometry"));
@@ -239,7 +239,7 @@ int main(int argc, char *argv[])
t1->addAnimation(new QPropertyAnimation(p5, "opacity"));
t1->addAnimation(new QPropertyAnimation(p6, "opacity"));
- QAbstractTransition *t2 = state2->addTransition(button, SIGNAL(clicked()), state3);
+ QAbstractTransition *t2 = state2->addTransition(button, &QAbstractButton::clicked, state3);
t2->addAnimation(new QPropertyAnimation(box, "geometry"));
t2->addAnimation(new QPropertyAnimation(widget, "geometry"));
t2->addAnimation(new QPropertyAnimation(p1, "pos"));
@@ -261,7 +261,7 @@ int main(int argc, char *argv[])
t2->addAnimation(new QPropertyAnimation(p5, "opacity"));
t2->addAnimation(new QPropertyAnimation(p6, "opacity"));
- QAbstractTransition *t3 = state3->addTransition(button, SIGNAL(clicked()), state1);
+ QAbstractTransition *t3 = state3->addTransition(button, &QAbstractButton::clicked, state1);
t3->addAnimation(new QPropertyAnimation(box, "geometry"));
t3->addAnimation(new QPropertyAnimation(widget, "geometry"));
t3->addAnimation(new QPropertyAnimation(p1, "pos"));
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) {
diff --git a/examples/widgets/animation/sub-attaq/animationmanager.cpp b/examples/widgets/animation/sub-attaq/animationmanager.cpp
index b6e399967f..62dac7852a 100644
--- a/examples/widgets/animation/sub-attaq/animationmanager.cpp
+++ b/examples/widgets/animation/sub-attaq/animationmanager.cpp
@@ -71,7 +71,7 @@ AnimationManager *AnimationManager::self()
void AnimationManager::registerAnimation(QAbstractAnimation *anim)
{
- QObject::connect(anim, SIGNAL(destroyed(QObject*)), this, SLOT(unregisterAnimation_helper(QObject*)));
+ QObject::connect(anim, &QObject::destroyed, this, &AnimationManager::unregisterAnimation_helper);
animations.append(anim);
}
@@ -82,7 +82,7 @@ void AnimationManager::unregisterAnimation_helper(QObject *obj)
void AnimationManager::unregisterAnimation(QAbstractAnimation *anim)
{
- QObject::disconnect(anim, SIGNAL(destroyed(QObject*)), this, SLOT(unregisterAnimation_helper(QObject*)));
+ QObject::disconnect(anim, &QObject::destroyed, this, &AnimationManager::unregisterAnimation_helper);
animations.removeAll(anim);
}
diff --git a/examples/widgets/animation/sub-attaq/boat.cpp b/examples/widgets/animation/sub-attaq/boat.cpp
index 145d373e99..9f4feba2ec 100644
--- a/examples/widgets/animation/sub-attaq/boat.cpp
+++ b/examples/widgets/animation/sub-attaq/boat.cpp
@@ -148,8 +148,8 @@ Boat::Boat() : PixmapItem(QString("boat"), GraphicsScene::Big),
stopState->addTransition(leftMoveStop);
//The animation is finished, it means we reached the border of the screen, the boat is stopped so we move to the stop state
- moveStateLeft->addTransition(movementAnimation, SIGNAL(finished()), stopState);
- moveStateRight->addTransition(movementAnimation, SIGNAL(finished()), stopState);
+ moveStateLeft->addTransition(movementAnimation, &QAbstractAnimation::finished, stopState);
+ moveStateRight->addTransition(movementAnimation, &QAbstractAnimation::finished, stopState);
//We set up the keys for dropping bombs
KeyLaunchTransition *upFireLeft = new KeyLaunchTransition(this, QEvent::KeyPress, Qt::Key_Up);
@@ -187,13 +187,13 @@ Boat::Boat() : PixmapItem(QString("boat"), GraphicsScene::Big),
destroyedState->setAnimation(destroyAnimation);
//Play a nice animation when the boat is destroyed
- moving->addTransition(this, SIGNAL(boatDestroyed()), destroyedState);
+ moving->addTransition(this, &Boat::boatDestroyed, destroyedState);
//Transition to final state when the destroyed animation is finished
- destroyedState->addTransition(destroyedState, SIGNAL(animationFinished()), final);
+ destroyedState->addTransition(destroyedState, &QAnimationState::animationFinished, final);
//The machine has finished to be executed, then the boat is dead
- connect(machine,SIGNAL(finished()), this, SIGNAL(boatExecutionFinished()));
+ connect(machine,&QState::finished, this, &Boat::boatExecutionFinished);
}
diff --git a/examples/widgets/animation/sub-attaq/bomb.cpp b/examples/widgets/animation/sub-attaq/bomb.cpp
index a80d2d46c5..76e4575293 100644
--- a/examples/widgets/animation/sub-attaq/bomb.cpp
+++ b/examples/widgets/animation/sub-attaq/bomb.cpp
@@ -83,8 +83,8 @@ void Bomb::launch(Bomb::Direction direction)
anim->setEndValue(QPointF(x() + delta*2,scene()->height()));
anim->setDuration(y()/2*60);
launchAnimation->addAnimation(anim);
- connect(anim,SIGNAL(valueChanged(QVariant)),this,SLOT(onAnimationLaunchValueChanged(QVariant)));
- connect(this, SIGNAL(bombExploded()), launchAnimation, SLOT(stop()));
+ connect(anim,&QVariantAnimation::valueChanged,this,&Bomb::onAnimationLaunchValueChanged);
+ connect(this, &Bomb::bombExploded, launchAnimation, &QAbstractAnimation::stop);
//We setup the state machine of the bomb
QStateMachine *machine = new QStateMachine(this);
@@ -98,13 +98,13 @@ void Bomb::launch(Bomb::Direction direction)
machine->setInitialState(launched);
//### Add a nice animation when the bomb is destroyed
- launched->addTransition(this, SIGNAL(bombExploded()),final);
+ launched->addTransition(this, &Bomb::bombExploded,final);
//If the animation is finished, then we move to the final state
- launched->addTransition(launched, SIGNAL(animationFinished()), final);
+ launched->addTransition(launched, &QAnimationState::animationFinished, final);
//The machine has finished to be executed, then the boat is dead
- connect(machine,SIGNAL(finished()),this, SIGNAL(bombExecutionFinished()));
+ connect(machine,&QState::finished,this, &Bomb::bombExecutionFinished);
machine->start();
diff --git a/examples/widgets/animation/sub-attaq/graphicsscene.cpp b/examples/widgets/animation/sub-attaq/graphicsscene.cpp
index e0913f99f6..3205cdc54d 100644
--- a/examples/widgets/animation/sub-attaq/graphicsscene.cpp
+++ b/examples/widgets/animation/sub-attaq/graphicsscene.cpp
@@ -191,15 +191,15 @@ void GraphicsScene::setupScene(QAction *newAction, QAction *quitAction)
lettersFadingState->setAnimation(lettersGroupFading);
//if new game then we fade out the welcome screen and start playing
- lettersMovingState->addTransition(newAction, SIGNAL(triggered()), lettersFadingState);
- lettersFadingState->addTransition(lettersFadingState, SIGNAL(animationFinished()), gameState);
+ lettersMovingState->addTransition(newAction, &QAction::triggered, lettersFadingState);
+ lettersFadingState->addTransition(lettersFadingState, &QAnimationState::animationFinished, gameState);
//New Game is triggered then player start playing
- gameState->addTransition(newAction, SIGNAL(triggered()), gameState);
+ gameState->addTransition(newAction, &QAction::triggered, gameState);
//Wanna quit, then connect to CTRL+Q
- gameState->addTransition(quitAction, SIGNAL(triggered()), final);
- lettersMovingState->addTransition(quitAction, SIGNAL(triggered()), final);
+ gameState->addTransition(quitAction, &QAction::triggered, final);
+ lettersMovingState->addTransition(quitAction, &QAction::triggered, final);
//Welcome screen is the initial state
machine->setInitialState(lettersMovingState);
@@ -207,27 +207,27 @@ void GraphicsScene::setupScene(QAction *newAction, QAction *quitAction)
machine->start();
//We reach the final state, then we quit
- connect(machine, SIGNAL(finished()), qApp, SLOT(quit()));
+ connect(machine, &QStateMachine::finished, qApp, &QApplication::quit);
}
void GraphicsScene::addItem(Bomb *bomb)
{
bombs.insert(bomb);
- connect(bomb,SIGNAL(bombExecutionFinished()),this, SLOT(onBombExecutionFinished()));
+ connect(bomb,&Bomb::bombExecutionFinished,this, &GraphicsScene::onBombExecutionFinished);
QGraphicsScene::addItem(bomb);
}
void GraphicsScene::addItem(Torpedo *torpedo)
{
torpedos.insert(torpedo);
- connect(torpedo,SIGNAL(torpedoExecutionFinished()),this, SLOT(onTorpedoExecutionFinished()));
+ connect(torpedo,&Torpedo::torpedoExecutionFinished,this, &GraphicsScene::onTorpedoExecutionFinished);
QGraphicsScene::addItem(torpedo);
}
void GraphicsScene::addItem(SubMarine *submarine)
{
submarines.insert(submarine);
- connect(submarine,SIGNAL(subMarineExecutionFinished()),this, SLOT(onSubMarineExecutionFinished()));
+ connect(submarine,&SubMarine::subMarineExecutionFinished,this, &GraphicsScene::onSubMarineExecutionFinished);
QGraphicsScene::addItem(submarine);
}
diff --git a/examples/widgets/animation/sub-attaq/qanimationstate.cpp b/examples/widgets/animation/sub-attaq/qanimationstate.cpp
index ae24af6da3..fc0da7cea2 100644
--- a/examples/widgets/animation/sub-attaq/qanimationstate.cpp
+++ b/examples/widgets/animation/sub-attaq/qanimationstate.cpp
@@ -73,7 +73,7 @@ QAnimationState *s = new QAnimationState(machine->rootState());
QPropertyAnimation *animation = new QPropertyAnimation(obj, "pos");
s->setAnimation(animation);
QState *s2 = new QState(machine->rootState());
-s->addTransition(s, SIGNAL(animationFinished()), s2);
+s->addTransition(s, &QAnimationState::animationFinished, s2);
machine.start();
\endcode
@@ -107,13 +107,13 @@ void QAnimationState::setAnimation(QAbstractAnimation *animation)
//Disconnect from the previous animation if exist
if(m_animation)
- disconnect(m_animation, SIGNAL(finished()), this, SIGNAL(animationFinished()));
+ disconnect(m_animation, &QAbstractAnimation::finished, this, &QAnimationState::animationFinished);
m_animation = animation;
if (m_animation) {
//connect the new animation
- connect(m_animation, SIGNAL(finished()), this, SIGNAL(animationFinished()));
+ connect(m_animation, &QAbstractAnimation::finished, this, &QAnimationState::animationFinished);
}
}
diff --git a/examples/widgets/animation/sub-attaq/states.cpp b/examples/widgets/animation/sub-attaq/states.cpp
index e19704db7b..8a3a97a20f 100644
--- a/examples/widgets/animation/sub-attaq/states.cpp
+++ b/examples/widgets/animation/sub-attaq/states.cpp
@@ -124,7 +124,7 @@ void PlayState::onEntry(QEvent *)
WinState *winState = new WinState(scene, this, machine);
//The boat has been destroyed then the game is finished
- levelState->addTransition(scene->boat, SIGNAL(boatExecutionFinished()),lostState);
+ levelState->addTransition(scene->boat, &Boat::boatExecutionFinished,lostState);
//This transition check if we won or not
WinTransition *winTransition = new WinTransition(scene, this, winState);
@@ -157,7 +157,7 @@ void PlayState::onEntry(QEvent *)
winState->addTransition(spaceTransition);
//We lost we should reach the final state
- lostState->addTransition(lostState, SIGNAL(finished()), final);
+ lostState->addTransition(lostState, &QState::finished, final);
machine->start();
}
@@ -291,8 +291,8 @@ UpdateScoreState::UpdateScoreState(QState *parent) : QState(parent)
/** Win transition */
UpdateScoreTransition::UpdateScoreTransition(GraphicsScene *scene, PlayState *game, QAbstractState *target)
- : QSignalTransition(scene,SIGNAL(subMarineDestroyed(int))),
- game(game), scene(scene)
+ : QSignalTransition(scene, &GraphicsScene::subMarineDestroyed),
+ game(game), scene(scene)
{
setTargetState(target);
}
@@ -309,8 +309,8 @@ bool UpdateScoreTransition::eventTest(QEvent *event)
/** Win transition */
WinTransition::WinTransition(GraphicsScene *scene, PlayState *game, QAbstractState *target)
- : QSignalTransition(scene,SIGNAL(allSubMarineDestroyed(int))),
- game(game), scene(scene)
+ : QSignalTransition(scene, &GraphicsScene::allSubMarineDestroyed),
+ game(game), scene(scene)
{
setTargetState(target);
}
diff --git a/examples/widgets/animation/sub-attaq/submarine.cpp b/examples/widgets/animation/sub-attaq/submarine.cpp
index a451185ce0..775e75ceed 100644
--- a/examples/widgets/animation/sub-attaq/submarine.cpp
+++ b/examples/widgets/animation/sub-attaq/submarine.cpp
@@ -106,7 +106,7 @@ SubMarine::SubMarine(int type, const QString &name, int points) : PixmapItem(QSt
//This is the initial state of the moving root state
moving->setInitialState(movement);
- movement->addTransition(this, SIGNAL(subMarineStateChanged()), moving);
+ movement->addTransition(this, &SubMarine::subMarineStateChanged, moving);
//This is the initial state of the machine
machine->setInitialState(moving);
@@ -115,23 +115,23 @@ SubMarine::SubMarine(int type, const QString &name, int points) : PixmapItem(QSt
QFinalState *final = new QFinalState(machine);
//If the moving animation is finished we move to the return state
- movement->addTransition(movement, SIGNAL(animationFinished()), rotation);
+ movement->addTransition(movement, &QAnimationState::animationFinished, rotation);
//If the return animation is finished we move to the moving state
- rotation->addTransition(rotation, SIGNAL(animationFinished()), movement);
+ rotation->addTransition(rotation, &QAnimationState::animationFinished, movement);
//This state play the destroyed animation
QAnimationState *destroyedState = new QAnimationState(machine);
destroyedState->setAnimation(setupDestroyAnimation(this));
//Play a nice animation when the submarine is destroyed
- moving->addTransition(this, SIGNAL(subMarineDestroyed()), destroyedState);
+ moving->addTransition(this, &SubMarine::subMarineDestroyed, destroyedState);
//Transition to final state when the destroyed animation is finished
- destroyedState->addTransition(destroyedState, SIGNAL(animationFinished()), final);
+ destroyedState->addTransition(destroyedState, &QAnimationState::animationFinished, final);
//The machine has finished to be executed, then the submarine is dead
- connect(machine,SIGNAL(finished()),this, SIGNAL(subMarineExecutionFinished()));
+ connect(machine,&QState::finished,this, &SubMarine::subMarineExecutionFinished);
machine->start();
}
diff --git a/examples/widgets/animation/sub-attaq/submarine_p.h b/examples/widgets/animation/sub-attaq/submarine_p.h
index 698b4b494f..1c2cb7ceac 100644
--- a/examples/widgets/animation/sub-attaq/submarine_p.h
+++ b/examples/widgets/animation/sub-attaq/submarine_p.h
@@ -80,7 +80,8 @@ public:
explicit MovementState(SubMarine *submarine, QState *parent = 0) : QAnimationState(parent)
{
movementAnimation = new QPropertyAnimation(submarine, "pos");
- connect(movementAnimation,SIGNAL(valueChanged(const QVariant &)),this,SLOT(onAnimationMovementValueChanged(const QVariant &)));
+ connect(movementAnimation, &QPropertyAnimation::valueChanged,
+ this, &MovementState::onAnimationMovementValueChanged);
setAnimation(movementAnimation);
AnimationManager::self()->registerAnimation(movementAnimation);
this->submarine = submarine;
diff --git a/examples/widgets/animation/sub-attaq/torpedo.cpp b/examples/widgets/animation/sub-attaq/torpedo.cpp
index 2e9d970326..5f8ef2f2b8 100644
--- a/examples/widgets/animation/sub-attaq/torpedo.cpp
+++ b/examples/widgets/animation/sub-attaq/torpedo.cpp
@@ -73,8 +73,8 @@ void Torpedo::launch()
launchAnimation->setEndValue(QPointF(x(),qobject_cast<GraphicsScene *>(scene())->sealLevel() - 15));
launchAnimation->setEasingCurve(QEasingCurve::InQuad);
launchAnimation->setDuration(y()/currentSpeed*10);
- connect(launchAnimation,SIGNAL(valueChanged(QVariant)),this,SLOT(onAnimationLaunchValueChanged(QVariant)));
- connect(this,SIGNAL(torpedoExploded()), launchAnimation, SLOT(stop()));
+ connect(launchAnimation,&QVariantAnimation::valueChanged,this,&Torpedo::onAnimationLaunchValueChanged);
+ connect(this,&Torpedo::torpedoExploded, launchAnimation, &QAbstractAnimation::stop);
//We setup the state machine of the torpedo
QStateMachine *machine = new QStateMachine(this);
@@ -89,13 +89,13 @@ void Torpedo::launch()
machine->setInitialState(launched);
//### Add a nice animation when the torpedo is destroyed
- launched->addTransition(this, SIGNAL(torpedoExploded()),final);
+ launched->addTransition(this, &Torpedo::torpedoExploded,final);
//If the animation is finished, then we move to the final state
- launched->addTransition(launched, SIGNAL(animationFinished()), final);
+ launched->addTransition(launched, &QAnimationState::animationFinished, final);
//The machine has finished to be executed, then the boat is dead
- connect(machine,SIGNAL(finished()),this, SIGNAL(torpedoExecutionFinished()));
+ connect(machine,&QState::finished,this, &Torpedo::torpedoExecutionFinished);
machine->start();
}