summaryrefslogtreecommitdiffstats
path: root/examples/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'examples/widgets')
-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
-rw-r--r--examples/widgets/effects/fademessage/fademessage.cpp2
-rw-r--r--examples/widgets/graphicsview/boxes/scene.cpp42
-rw-r--r--examples/widgets/graphicsview/chip/view.cpp32
-rw-r--r--examples/widgets/graphicsview/collidingmice/main.cpp2
-rw-r--r--examples/widgets/graphicsview/diagramscene/diagramscene.cpp8
-rw-r--r--examples/widgets/graphicsview/diagramscene/mainwindow.cpp64
-rw-r--r--examples/widgets/graphicsview/embeddeddialogs/customproxy.cpp8
21 files changed, 148 insertions, 138 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();
}
diff --git a/examples/widgets/effects/fademessage/fademessage.cpp b/examples/widgets/effects/fademessage/fademessage.cpp
index 9943147bb7..4c3a70bb4f 100644
--- a/examples/widgets/effects/fademessage/fademessage.cpp
+++ b/examples/widgets/effects/fademessage/fademessage.cpp
@@ -131,7 +131,7 @@ void FadeMessage::setupScene()
QPushButton *press = new QPushButton;
press->setText(tr("Press me"));
- connect(press, SIGNAL(clicked()), SLOT(togglePopup()));
+ connect(press, &QAbstractButton::clicked, this, &FadeMessage::togglePopup);
m_scene.addWidget(press);
press->move(300, 500);
diff --git a/examples/widgets/graphicsview/boxes/scene.cpp b/examples/widgets/graphicsview/boxes/scene.cpp
index 1637c1f781..3c65206c02 100644
--- a/examples/widgets/graphicsview/boxes/scene.cpp
+++ b/examples/widgets/graphicsview/boxes/scene.cpp
@@ -111,7 +111,7 @@ ColorEdit::ColorEdit(QRgb initialColor, int id)
m_button->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
layout->addWidget(m_button);
- connect(m_lineEdit, SIGNAL(editingFinished()), this, SLOT(editDone()));
+ connect(m_lineEdit, &QLineEdit::editingFinished, this, &ColorEdit::editDone);
}
void ColorEdit::editDone()
@@ -166,7 +166,7 @@ FloatEdit::FloatEdit(float initialValue, int id)
m_lineEdit = new QLineEdit(QString::number(m_value));
layout->addWidget(m_lineEdit);
- connect(m_lineEdit, SIGNAL(editingFinished()), this, SLOT(editDone()));
+ connect(m_lineEdit, &QLineEdit::editingFinished, this, &FloatEdit::editDone);
}
void FloatEdit::editDone()
@@ -252,7 +252,7 @@ void TwoSidedGraphicsWidget::animateFlip()
.translate(-r.width() / 2, -r.height() / 2));
if ((m_current == 0 && m_angle > 0) || (m_current == 1 && m_angle < 180))
- QTimer::singleShot(25, this, SLOT(animateFlip()));
+ QTimer::singleShot(25, this, &TwoSidedGraphicsWidget::animateFlip);
}
QVariant GraphicsWidget::itemChange(GraphicsItemChange change, const QVariant &value)
@@ -307,7 +307,7 @@ RenderOptionsDialog::RenderOptionsDialog()
check->setCheckState(Qt::Unchecked);
// Dynamic cube maps are only enabled when multi-texturing and render to texture are available.
check->setEnabled(glActiveTexture && glGenFramebuffersEXT);
- connect(check, SIGNAL(stateChanged(int)), this, SIGNAL(dynamicCubemapToggled(int)));
+ connect(check, &QCheckBox::stateChanged, this, &RenderOptionsDialog::dynamicCubemapToggled);
layout->addWidget(check, 0, 0, 1, 2);
++row;
@@ -356,7 +356,7 @@ RenderOptionsDialog::RenderOptionsDialog()
ColorEdit *colorEdit = new ColorEdit(it->toUInt(&ok, 16), m_parameterNames.size() - 1);
m_parameterEdits << colorEdit;
layout->addWidget(colorEdit);
- connect(colorEdit, SIGNAL(colorChanged(QRgb,int)), this, SLOT(setColorParameter(QRgb,int)));
+ connect(colorEdit, &ColorEdit::colorChanged, this, &RenderOptionsDialog::setColorParameter);
++row;
} else if (type == "float") {
layout->addWidget(new QLabel(m_parameterNames.back()));
@@ -364,7 +364,7 @@ RenderOptionsDialog::RenderOptionsDialog()
FloatEdit *floatEdit = new FloatEdit(it->toFloat(&ok), m_parameterNames.size() - 1);
m_parameterEdits << floatEdit;
layout->addWidget(floatEdit);
- connect(floatEdit, SIGNAL(valueChanged(float,int)), this, SLOT(setFloatParameter(float,int)));
+ connect(floatEdit, &FloatEdit::valueChanged, this, &RenderOptionsDialog::setFloatParameter);
++row;
}
}
@@ -375,13 +375,15 @@ RenderOptionsDialog::RenderOptionsDialog()
layout->addWidget(new QLabel(tr("Texture:")));
m_textureCombo = new QComboBox;
- connect(m_textureCombo, SIGNAL(currentIndexChanged(int)), this, SIGNAL(textureChanged(int)));
+ connect(m_textureCombo, QOverload<int>::of(&QComboBox::currentIndexChanged),
+ this, &RenderOptionsDialog::textureChanged);
layout->addWidget(m_textureCombo);
++row;
layout->addWidget(new QLabel(tr("Shader:")));
m_shaderCombo = new QComboBox;
- connect(m_shaderCombo, SIGNAL(currentIndexChanged(int)), this, SIGNAL(shaderChanged(int)));
+ connect(m_shaderCombo, QOverload<int>::of(&QComboBox::currentIndexChanged),
+ this, &RenderOptionsDialog::shaderChanged);
layout->addWidget(m_shaderCombo);
++row;
@@ -439,15 +441,15 @@ ItemDialog::ItemDialog()
button = new QPushButton(tr("Add Qt box"));
layout->addWidget(button);
- connect(button, SIGNAL(clicked()), this, SLOT(triggerNewQtBox()));
+ connect(button, &QAbstractButton::clicked, this, &ItemDialog::triggerNewQtBox);
button = new QPushButton(tr("Add circle"));
layout->addWidget(button);
- connect(button, SIGNAL(clicked()), this, SLOT(triggerNewCircleItem()));
+ connect(button, &QAbstractButton::clicked, this, &ItemDialog::triggerNewCircleItem);
button = new QPushButton(tr("Add square"));
layout->addWidget(button);
- connect(button, SIGNAL(clicked()), this, SLOT(triggerNewSquareItem()));
+ connect(button, &QAbstractButton::clicked, this, &ItemDialog::triggerNewSquareItem);
layout->addStretch(1);
}
@@ -506,21 +508,21 @@ Scene::Scene(int width, int height, int maxTextureSize)
m_renderOptions->move(20, 120);
m_renderOptions->resize(m_renderOptions->sizeHint());
- connect(m_renderOptions, SIGNAL(dynamicCubemapToggled(int)), this, SLOT(toggleDynamicCubemap(int)));
- connect(m_renderOptions, SIGNAL(colorParameterChanged(QString,QRgb)), this, SLOT(setColorParameter(QString,QRgb)));
- connect(m_renderOptions, SIGNAL(floatParameterChanged(QString,float)), this, SLOT(setFloatParameter(QString,float)));
- connect(m_renderOptions, SIGNAL(textureChanged(int)), this, SLOT(setTexture(int)));
- connect(m_renderOptions, SIGNAL(shaderChanged(int)), this, SLOT(setShader(int)));
+ connect(m_renderOptions, &RenderOptionsDialog::dynamicCubemapToggled, this, &Scene::toggleDynamicCubemap);
+ connect(m_renderOptions, &RenderOptionsDialog::colorParameterChanged, this, &Scene::setColorParameter);
+ connect(m_renderOptions, &RenderOptionsDialog::floatParameterChanged, this, &Scene::setFloatParameter);
+ connect(m_renderOptions, &RenderOptionsDialog::textureChanged, this, &Scene::setTexture);
+ connect(m_renderOptions, &RenderOptionsDialog::shaderChanged, this, &Scene::setShader);
m_itemDialog = new ItemDialog;
- connect(m_itemDialog, SIGNAL(newItemTriggered(ItemDialog::ItemType)), this, SLOT(newItem(ItemDialog::ItemType)));
+ connect(m_itemDialog, &ItemDialog::newItemTriggered, this, &Scene::newItem);
TwoSidedGraphicsWidget *twoSided = new TwoSidedGraphicsWidget(this);
twoSided->setWidget(0, m_renderOptions);
twoSided->setWidget(1, m_itemDialog);
- connect(m_renderOptions, SIGNAL(doubleClicked()), twoSided, SLOT(flip()));
- connect(m_itemDialog, SIGNAL(doubleClicked()), twoSided, SLOT(flip()));
+ connect(m_renderOptions, &RenderOptionsDialog::doubleClicked, twoSided, &TwoSidedGraphicsWidget::flip);
+ connect(m_itemDialog, &ItemDialog::doubleClicked, twoSided, &TwoSidedGraphicsWidget::flip);
addItem(new QtBox(64, width - 64, height - 64));
addItem(new QtBox(64, width - 64, 64));
@@ -531,7 +533,7 @@ Scene::Scene(int width, int height, int maxTextureSize)
m_timer = new QTimer(this);
m_timer->setInterval(20);
- connect(m_timer, SIGNAL(timeout()), this, SLOT(update()));
+ connect(m_timer, &QTimer::timeout, this, [this](){ update(); });
m_timer->start();
m_time.start();
diff --git a/examples/widgets/graphicsview/chip/view.cpp b/examples/widgets/graphicsview/chip/view.cpp
index 491f1a54cf..9676c13ff7 100644
--- a/examples/widgets/graphicsview/chip/view.cpp
+++ b/examples/widgets/graphicsview/chip/view.cpp
@@ -190,22 +190,22 @@ View::View(const QString &name, QWidget *parent)
topLayout->addWidget(resetButton, 2, 1);
setLayout(topLayout);
- connect(resetButton, SIGNAL(clicked()), this, SLOT(resetView()));
- connect(zoomSlider, SIGNAL(valueChanged(int)), this, SLOT(setupMatrix()));
- connect(rotateSlider, SIGNAL(valueChanged(int)), this, SLOT(setupMatrix()));
- connect(graphicsView->verticalScrollBar(), SIGNAL(valueChanged(int)),
- this, SLOT(setResetButtonEnabled()));
- connect(graphicsView->horizontalScrollBar(), SIGNAL(valueChanged(int)),
- this, SLOT(setResetButtonEnabled()));
- connect(selectModeButton, SIGNAL(toggled(bool)), this, SLOT(togglePointerMode()));
- connect(dragModeButton, SIGNAL(toggled(bool)), this, SLOT(togglePointerMode()));
- connect(antialiasButton, SIGNAL(toggled(bool)), this, SLOT(toggleAntialiasing()));
- connect(openGlButton, SIGNAL(toggled(bool)), this, SLOT(toggleOpenGL()));
- connect(rotateLeftIcon, SIGNAL(clicked()), this, SLOT(rotateLeft()));
- connect(rotateRightIcon, SIGNAL(clicked()), this, SLOT(rotateRight()));
- connect(zoomInIcon, SIGNAL(clicked()), this, SLOT(zoomIn()));
- connect(zoomOutIcon, SIGNAL(clicked()), this, SLOT(zoomOut()));
- connect(printButton, SIGNAL(clicked()), this, SLOT(print()));
+ connect(resetButton, &QAbstractButton::clicked, this, &View::resetView);
+ connect(zoomSlider, &QAbstractSlider::valueChanged, this, &View::setupMatrix);
+ connect(rotateSlider, &QAbstractSlider::valueChanged, this, &View::setupMatrix);
+ connect(graphicsView->verticalScrollBar(), &QAbstractSlider::valueChanged,
+ this, &View::setResetButtonEnabled);
+ connect(graphicsView->horizontalScrollBar(), &QAbstractSlider::valueChanged,
+ this, &View::setResetButtonEnabled);
+ connect(selectModeButton, &QAbstractButton::toggled, this, &View::togglePointerMode);
+ connect(dragModeButton, &QAbstractButton::toggled, this, &View::togglePointerMode);
+ connect(antialiasButton, &QAbstractButton::toggled, this, &View::toggleAntialiasing);
+ connect(openGlButton, &QAbstractButton::toggled, this, &View::toggleOpenGL);
+ connect(rotateLeftIcon, &QAbstractButton::clicked, this, &View::rotateLeft);
+ connect(rotateRightIcon, &QAbstractButton::clicked, this, &View::rotateRight);
+ connect(zoomInIcon, &QAbstractButton::clicked, this, &View::zoomIn);
+ connect(zoomOutIcon, &QAbstractButton::clicked, this, &View::zoomOut);
+ connect(printButton, &QAbstractButton::clicked, this, &View::print);
setupMatrix();
}
diff --git a/examples/widgets/graphicsview/collidingmice/main.cpp b/examples/widgets/graphicsview/collidingmice/main.cpp
index 91aee70b86..dfb20815b9 100644
--- a/examples/widgets/graphicsview/collidingmice/main.cpp
+++ b/examples/widgets/graphicsview/collidingmice/main.cpp
@@ -92,7 +92,7 @@ int main(int argc, char **argv)
view.show();
QTimer timer;
- QObject::connect(&timer, SIGNAL(timeout()), &scene, SLOT(advance()));
+ QObject::connect(&timer, &QTimer::timeout, &scene, &QGraphicsScene::advance);
timer.start(1000 / 33);
return app.exec();
diff --git a/examples/widgets/graphicsview/diagramscene/diagramscene.cpp b/examples/widgets/graphicsview/diagramscene/diagramscene.cpp
index bbbc512b55..51d855cc75 100644
--- a/examples/widgets/graphicsview/diagramscene/diagramscene.cpp
+++ b/examples/widgets/graphicsview/diagramscene/diagramscene.cpp
@@ -169,10 +169,10 @@ void DiagramScene::mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent)
textItem->setFont(myFont);
textItem->setTextInteractionFlags(Qt::TextEditorInteraction);
textItem->setZValue(1000.0);
- connect(textItem, SIGNAL(lostFocus(DiagramTextItem*)),
- this, SLOT(editorLostFocus(DiagramTextItem*)));
- connect(textItem, SIGNAL(selectedChange(QGraphicsItem*)),
- this, SIGNAL(itemSelected(QGraphicsItem*)));
+ connect(textItem, &DiagramTextItem::lostFocus,
+ this, &DiagramScene::editorLostFocus);
+ connect(textItem, &DiagramTextItem::selectedChange,
+ this, &DiagramScene::itemSelected);
addItem(textItem);
textItem->setDefaultTextColor(myTextColor);
textItem->setPos(mouseEvent->scenePos());
diff --git a/examples/widgets/graphicsview/diagramscene/mainwindow.cpp b/examples/widgets/graphicsview/diagramscene/mainwindow.cpp
index 36353674ea..875c41b284 100644
--- a/examples/widgets/graphicsview/diagramscene/mainwindow.cpp
+++ b/examples/widgets/graphicsview/diagramscene/mainwindow.cpp
@@ -67,12 +67,12 @@ MainWindow::MainWindow()
scene = new DiagramScene(itemMenu, this);
scene->setSceneRect(QRectF(0, 0, 5000, 5000));
- connect(scene, SIGNAL(itemInserted(DiagramItem*)),
- this, SLOT(itemInserted(DiagramItem*)));
- connect(scene, SIGNAL(textInserted(QGraphicsTextItem*)),
- this, SLOT(textInserted(QGraphicsTextItem*)));
- connect(scene, SIGNAL(itemSelected(QGraphicsItem*)),
- this, SLOT(itemSelected(QGraphicsItem*)));
+ connect(scene, &DiagramScene::itemInserted,
+ this, &MainWindow::itemInserted);
+ connect(scene, &DiagramScene::textInserted,
+ this, &MainWindow::textInserted);
+ connect(scene, &DiagramScene::itemSelected,
+ this, &MainWindow::itemSelected);
createToolbars();
QHBoxLayout *layout = new QHBoxLayout;
@@ -332,8 +332,8 @@ void MainWindow::createToolBox()
{
buttonGroup = new QButtonGroup(this);
buttonGroup->setExclusive(false);
- connect(buttonGroup, SIGNAL(buttonClicked(int)),
- this, SLOT(buttonGroupClicked(int)));
+ connect(buttonGroup, QOverload<int>::of(&QButtonGroup::buttonClicked),
+ this, &MainWindow::buttonGroupClicked);
QGridLayout *layout = new QGridLayout;
layout->addWidget(createCellWidget(tr("Conditional"), DiagramItem::Conditional), 0, 0);
layout->addWidget(createCellWidget(tr("Process"), DiagramItem::Step),0, 1);
@@ -359,8 +359,8 @@ void MainWindow::createToolBox()
itemWidget->setLayout(layout);
backgroundButtonGroup = new QButtonGroup(this);
- connect(backgroundButtonGroup, SIGNAL(buttonClicked(QAbstractButton*)),
- this, SLOT(backgroundButtonGroupClicked(QAbstractButton*)));
+ connect(backgroundButtonGroup, QOverload<QAbstractButton *>::of(&QButtonGroup::buttonClicked),
+ this, &MainWindow::backgroundButtonGroupClicked);
QGridLayout *backgroundLayout = new QGridLayout;
backgroundLayout->addWidget(createBackgroundCellWidget(tr("Blue Grid"),
@@ -395,44 +395,44 @@ void MainWindow::createActions()
tr("Bring to &Front"), this);
toFrontAction->setShortcut(tr("Ctrl+F"));
toFrontAction->setStatusTip(tr("Bring item to front"));
- connect(toFrontAction, SIGNAL(triggered()), this, SLOT(bringToFront()));
+ connect(toFrontAction, &QAction::triggered, this, &MainWindow::bringToFront);
//! [23]
sendBackAction = new QAction(QIcon(":/images/sendtoback.png"), tr("Send to &Back"), this);
sendBackAction->setShortcut(tr("Ctrl+T"));
sendBackAction->setStatusTip(tr("Send item to back"));
- connect(sendBackAction, SIGNAL(triggered()), this, SLOT(sendToBack()));
+ connect(sendBackAction, &QAction::triggered, this, &MainWindow::sendToBack);
deleteAction = new QAction(QIcon(":/images/delete.png"), tr("&Delete"), this);
deleteAction->setShortcut(tr("Delete"));
deleteAction->setStatusTip(tr("Delete item from diagram"));
- connect(deleteAction, SIGNAL(triggered()), this, SLOT(deleteItem()));
+ connect(deleteAction, &QAction::triggered, this, &MainWindow::deleteItem);
exitAction = new QAction(tr("E&xit"), this);
exitAction->setShortcuts(QKeySequence::Quit);
exitAction->setStatusTip(tr("Quit Scenediagram example"));
- connect(exitAction, SIGNAL(triggered()), this, SLOT(close()));
+ connect(exitAction, &QAction::triggered, this, &QWidget::close);
boldAction = new QAction(tr("Bold"), this);
boldAction->setCheckable(true);
QPixmap pixmap(":/images/bold.png");
boldAction->setIcon(QIcon(pixmap));
boldAction->setShortcut(tr("Ctrl+B"));
- connect(boldAction, SIGNAL(triggered()), this, SLOT(handleFontChange()));
+ connect(boldAction, &QAction::triggered, this, &MainWindow::handleFontChange);
italicAction = new QAction(QIcon(":/images/italic.png"), tr("Italic"), this);
italicAction->setCheckable(true);
italicAction->setShortcut(tr("Ctrl+I"));
- connect(italicAction, SIGNAL(triggered()), this, SLOT(handleFontChange()));
+ connect(italicAction, &QAction::triggered, this, &MainWindow::handleFontChange);
underlineAction = new QAction(QIcon(":/images/underline.png"), tr("Underline"), this);
underlineAction->setCheckable(true);
underlineAction->setShortcut(tr("Ctrl+U"));
- connect(underlineAction, SIGNAL(triggered()), this, SLOT(handleFontChange()));
+ connect(underlineAction, &QAction::triggered, this, &MainWindow::handleFontChange);
aboutAction = new QAction(tr("A&bout"), this);
aboutAction->setShortcut(tr("F1"));
- connect(aboutAction, SIGNAL(triggered()), this, SLOT(about()));
+ connect(aboutAction, &QAction::triggered, this, &MainWindow::about);
}
//! [24]
@@ -462,8 +462,8 @@ void MainWindow::createToolbars()
editToolBar->addAction(sendBackAction);
fontCombo = new QFontComboBox();
- connect(fontCombo, SIGNAL(currentFontChanged(QFont)),
- this, SLOT(currentFontChanged(QFont)));
+ connect(fontCombo, &QFontComboBox::currentFontChanged,
+ this, &MainWindow::currentFontChanged);
fontSizeCombo = new QComboBox;
fontSizeCombo->setEditable(true);
@@ -471,8 +471,8 @@ void MainWindow::createToolbars()
fontSizeCombo->addItem(QString().setNum(i));
QIntValidator *validator = new QIntValidator(2, 64, this);
fontSizeCombo->setValidator(validator);
- connect(fontSizeCombo, SIGNAL(currentIndexChanged(QString)),
- this, SLOT(fontSizeChanged(QString)));
+ connect(fontSizeCombo, QOverload<const QString &>::of(&QComboBox::currentIndexChanged),
+ this, &MainWindow::fontSizeChanged);
fontColorToolButton = new QToolButton;
fontColorToolButton->setPopupMode(QToolButton::MenuButtonPopup);
@@ -480,8 +480,8 @@ void MainWindow::createToolbars()
textAction = fontColorToolButton->menu()->defaultAction();
fontColorToolButton->setIcon(createColorToolButtonIcon(":/images/textpointer.png", Qt::black));
fontColorToolButton->setAutoFillBackground(true);
- connect(fontColorToolButton, SIGNAL(clicked()),
- this, SLOT(textButtonTriggered()));
+ connect(fontColorToolButton, &QAbstractButton::clicked,
+ this, &MainWindow::textButtonTriggered);
//! [26]
fillColorToolButton = new QToolButton;
@@ -490,8 +490,8 @@ void MainWindow::createToolbars()
fillAction = fillColorToolButton->menu()->defaultAction();
fillColorToolButton->setIcon(createColorToolButtonIcon(
":/images/floodfill.png", Qt::white));
- connect(fillColorToolButton, SIGNAL(clicked()),
- this, SLOT(fillButtonTriggered()));
+ connect(fillColorToolButton, &QAbstractButton::clicked,
+ this, &MainWindow::fillButtonTriggered);
//! [26]
lineColorToolButton = new QToolButton;
@@ -500,8 +500,8 @@ void MainWindow::createToolbars()
lineAction = lineColorToolButton->menu()->defaultAction();
lineColorToolButton->setIcon(createColorToolButtonIcon(
":/images/linecolor.png", Qt::black));
- connect(lineColorToolButton, SIGNAL(clicked()),
- this, SLOT(lineButtonTriggered()));
+ connect(lineColorToolButton, &QAbstractButton::clicked,
+ this, &MainWindow::lineButtonTriggered);
textToolBar = addToolBar(tr("Font"));
textToolBar->addWidget(fontCombo);
@@ -526,16 +526,16 @@ void MainWindow::createToolbars()
pointerTypeGroup = new QButtonGroup(this);
pointerTypeGroup->addButton(pointerButton, int(DiagramScene::MoveItem));
pointerTypeGroup->addButton(linePointerButton, int(DiagramScene::InsertLine));
- connect(pointerTypeGroup, SIGNAL(buttonClicked(int)),
- this, SLOT(pointerGroupClicked(int)));
+ connect(pointerTypeGroup, QOverload<int>::of(&QButtonGroup::buttonClicked),
+ this, &MainWindow::pointerGroupClicked);
sceneScaleCombo = new QComboBox;
QStringList scales;
scales << tr("50%") << tr("75%") << tr("100%") << tr("125%") << tr("150%");
sceneScaleCombo->addItems(scales);
sceneScaleCombo->setCurrentIndex(2);
- connect(sceneScaleCombo, SIGNAL(currentIndexChanged(QString)),
- this, SLOT(sceneScaleChanged(QString)));
+ connect(sceneScaleCombo, QOverload<const QString &>::of(&QComboBox::currentIndexChanged),
+ this, &MainWindow::sceneScaleChanged);
pointerToolbar = addToolBar(tr("Pointer type"));
pointerToolbar->addWidget(pointerButton);
diff --git a/examples/widgets/graphicsview/embeddeddialogs/customproxy.cpp b/examples/widgets/graphicsview/embeddeddialogs/customproxy.cpp
index 158c31d9c1..c181a03e85 100644
--- a/examples/widgets/graphicsview/embeddeddialogs/customproxy.cpp
+++ b/examples/widgets/graphicsview/embeddeddialogs/customproxy.cpp
@@ -58,10 +58,10 @@ CustomProxy::CustomProxy(QGraphicsItem *parent, Qt::WindowFlags wFlags)
: QGraphicsProxyWidget(parent, wFlags), popupShown(false), currentPopup(0)
{
timeLine = new QTimeLine(250, this);
- connect(timeLine, SIGNAL(valueChanged(qreal)),
- this, SLOT(updateStep(qreal)));
- connect(timeLine, SIGNAL(stateChanged(QTimeLine::State)),
- this, SLOT(stateChanged(QTimeLine::State)));
+ connect(timeLine, &QTimeLine::valueChanged,
+ this, &CustomProxy::updateStep);
+ connect(timeLine, &QTimeLine::stateChanged,
+ this, &CustomProxy::stateChanged);
}
QRectF CustomProxy::boundingRect() const