diff options
author | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2018-12-02 14:16:47 +0100 |
---|---|---|
committer | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2019-01-26 10:37:06 +0000 |
commit | bf4bf3a58360d4f7907895096b452cb3821ea593 (patch) | |
tree | 0a784f40986afb9c73aed2f5d13a2f554a09ce2e /examples/widgets/widgets/movie | |
parent | e81acde7d0cf5fb44a3fb2cf0bf7aaa2c65f807e (diff) |
Cleanup Widgets examples - signals/slots
Cleanup the widgets examples - use new signal/slot syntax where possible
Change-Id: I6bc8953534d8b1efca0de4ee6a9fe4a6aa79fda9
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Reviewed-by: Konstantin Shegunov <kshegunov@gmail.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'examples/widgets/widgets/movie')
-rw-r--r-- | examples/widgets/widgets/movie/movieplayer.cpp | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/examples/widgets/widgets/movie/movieplayer.cpp b/examples/widgets/widgets/movie/movieplayer.cpp index 61e85537a3..3003bfb541 100644 --- a/examples/widgets/widgets/movie/movieplayer.cpp +++ b/examples/widgets/widgets/movie/movieplayer.cpp @@ -69,13 +69,12 @@ MoviePlayer::MoviePlayer(QWidget *parent) createControls(); createButtons(); - connect(movie, SIGNAL(frameChanged(int)), this, SLOT(updateFrameSlider())); - connect(movie, SIGNAL(stateChanged(QMovie::MovieState)), - this, SLOT(updateButtons())); - connect(fitCheckBox, SIGNAL(clicked()), this, SLOT(fitToWindow())); - connect(frameSlider, SIGNAL(valueChanged(int)), this, SLOT(goToFrame(int))); - connect(speedSpinBox, SIGNAL(valueChanged(int)), - movie, SLOT(setSpeed(int))); + connect(movie, &QMovie::frameChanged, this, &MoviePlayer::updateFrameSlider); + connect(movie, &QMovie::stateChanged, this, &MoviePlayer::updateButtons); + connect(fitCheckBox, &QCheckBox::clicked, this, &MoviePlayer::fitToWindow); + connect(frameSlider, &QSlider::valueChanged, this, &MoviePlayer::goToFrame); + connect(speedSpinBox, QOverload<int>::of(&QSpinBox::valueChanged), + movie, &QMovie::setSpeed); mainLayout = new QVBoxLayout; mainLayout->addWidget(movieLabel); @@ -182,32 +181,32 @@ void MoviePlayer::createButtons() openButton->setIcon(style()->standardIcon(QStyle::SP_DialogOpenButton)); openButton->setIconSize(iconSize); openButton->setToolTip(tr("Open File")); - connect(openButton, SIGNAL(clicked()), this, SLOT(open())); + connect(openButton, &QToolButton::clicked, this, &MoviePlayer::open); playButton = new QToolButton; playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay)); playButton->setIconSize(iconSize); playButton->setToolTip(tr("Play")); - connect(playButton, SIGNAL(clicked()), movie, SLOT(start())); + connect(playButton, &QToolButton::clicked, movie, &QMovie::start); pauseButton = new QToolButton; pauseButton->setCheckable(true); pauseButton->setIcon(style()->standardIcon(QStyle::SP_MediaPause)); pauseButton->setIconSize(iconSize); pauseButton->setToolTip(tr("Pause")); - connect(pauseButton, SIGNAL(clicked(bool)), movie, SLOT(setPaused(bool))); + connect(pauseButton, &QToolButton::clicked, movie, &QMovie::setPaused); stopButton = new QToolButton; stopButton->setIcon(style()->standardIcon(QStyle::SP_MediaStop)); stopButton->setIconSize(iconSize); stopButton->setToolTip(tr("Stop")); - connect(stopButton, SIGNAL(clicked()), movie, SLOT(stop())); + connect(stopButton, &QToolButton::clicked, movie, &QMovie::stop); quitButton = new QToolButton; quitButton->setIcon(style()->standardIcon(QStyle::SP_DialogCloseButton)); quitButton->setIconSize(iconSize); quitButton->setToolTip(tr("Quit")); - connect(quitButton, SIGNAL(clicked()), this, SLOT(close())); + connect(quitButton, &QToolButton::clicked, this, &MoviePlayer::close); buttonsLayout = new QHBoxLayout; buttonsLayout->addStretch(); |