From 93630cd621b472d73fc8456ca396cda012a1aee0 Mon Sep 17 00:00:00 2001 From: Jochen Seemann Date: Thu, 23 Nov 2017 21:12:24 +0100 Subject: examples: use Qt5-style connects where possible Additionally, remove obsolete CHECKED_CONNECT macro from the spectrum example. Change-Id: Id6fe01718679463c2b025d688c970583d64d60e9 Reviewed-by: VaL Doroshchuk Reviewed-by: Christian Stromme --- .../customvideoitem/videoplayer.cpp | 23 +++++++++++----------- .../customvideowidget/videoplayer.cpp | 19 +++++++++--------- 2 files changed, 22 insertions(+), 20 deletions(-) (limited to 'examples/multimediawidgets') diff --git a/examples/multimediawidgets/customvideosurface/customvideoitem/videoplayer.cpp b/examples/multimediawidgets/customvideosurface/customvideoitem/videoplayer.cpp index 7da566a20..60b93a116 100644 --- a/examples/multimediawidgets/customvideosurface/customvideoitem/videoplayer.cpp +++ b/examples/multimediawidgets/customvideosurface/customvideoitem/videoplayer.cpp @@ -80,24 +80,25 @@ VideoPlayer::VideoPlayer(QWidget *parent) rotateSlider->setRange(-180, 180); rotateSlider->setValue(0); - connect(rotateSlider, SIGNAL(valueChanged(int)), - this, SLOT(rotateVideo(int))); + connect(rotateSlider, &QSlider::valueChanged, + this, &VideoPlayer::rotateVideo); QAbstractButton *openButton = new QPushButton(tr("Open...")); - connect(openButton, SIGNAL(clicked()), this, SLOT(openFile())); + connect(openButton, &QAbstractButton::clicked, + this, &VideoPlayer::openFile); playButton = new QPushButton; playButton->setEnabled(false); playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay)); - connect(playButton, SIGNAL(clicked()), - this, SLOT(play())); + connect(playButton, &QAbstractButton::clicked, + this, &VideoPlayer::play); positionSlider = new QSlider(Qt::Horizontal); positionSlider->setRange(0, 0); - connect(positionSlider, SIGNAL(sliderMoved(int)), - this, SLOT(setPosition(int))); + connect(positionSlider, &QSlider::sliderMoved, + this, &VideoPlayer::setPosition); QBoxLayout *controlLayout = new QHBoxLayout; controlLayout->setMargin(0); @@ -113,10 +114,10 @@ VideoPlayer::VideoPlayer(QWidget *parent) setLayout(layout); mediaPlayer.setVideoOutput(videoItem); - connect(&mediaPlayer, SIGNAL(stateChanged(QMediaPlayer::State)), - this, SLOT(mediaStateChanged(QMediaPlayer::State))); - connect(&mediaPlayer, SIGNAL(positionChanged(qint64)), this, SLOT(positionChanged(qint64))); - connect(&mediaPlayer, SIGNAL(durationChanged(qint64)), this, SLOT(durationChanged(qint64))); + connect(&mediaPlayer, &QMediaPlayer::stateChanged, + this, &VideoPlayer::mediaStateChanged); + connect(&mediaPlayer, &QMediaPlayer::positionChanged, this, &VideoPlayer::positionChanged); + connect(&mediaPlayer, &QMediaPlayer::durationChanged, this, &VideoPlayer::durationChanged); } VideoPlayer::~VideoPlayer() diff --git a/examples/multimediawidgets/customvideosurface/customvideowidget/videoplayer.cpp b/examples/multimediawidgets/customvideosurface/customvideowidget/videoplayer.cpp index 7d0759c35..7730f8140 100644 --- a/examples/multimediawidgets/customvideosurface/customvideowidget/videoplayer.cpp +++ b/examples/multimediawidgets/customvideosurface/customvideowidget/videoplayer.cpp @@ -64,20 +64,21 @@ VideoPlayer::VideoPlayer(QWidget *parent) VideoWidget *videoWidget = new VideoWidget; QAbstractButton *openButton = new QPushButton(tr("Open...")); - connect(openButton, SIGNAL(clicked()), this, SLOT(openFile())); + connect(openButton, &QAbstractButton::clicked, + this, &VideoPlayer::openFile); playButton = new QPushButton; playButton->setEnabled(false); playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay)); - connect(playButton, SIGNAL(clicked()), - this, SLOT(play())); + connect(playButton, &QAbstractButton::clicked, + this, &VideoPlayer::play); positionSlider = new QSlider(Qt::Horizontal); positionSlider->setRange(0, 0); - connect(positionSlider, SIGNAL(sliderMoved(int)), - this, SLOT(setPosition(int))); + connect(positionSlider, &QSlider::sliderMoved, + this, &VideoPlayer::setPosition); QBoxLayout *controlLayout = new QHBoxLayout; controlLayout->setMargin(0); @@ -92,10 +93,10 @@ VideoPlayer::VideoPlayer(QWidget *parent) setLayout(layout); mediaPlayer.setVideoOutput(videoWidget->videoSurface()); - connect(&mediaPlayer, SIGNAL(stateChanged(QMediaPlayer::State)), - this, SLOT(mediaStateChanged(QMediaPlayer::State))); - connect(&mediaPlayer, SIGNAL(positionChanged(qint64)), this, SLOT(positionChanged(qint64))); - connect(&mediaPlayer, SIGNAL(durationChanged(qint64)), this, SLOT(durationChanged(qint64))); + connect(&mediaPlayer, &QMediaPlayer::stateChanged, + this, &VideoPlayer::mediaStateChanged); + connect(&mediaPlayer, &QMediaPlayer::positionChanged, this, &VideoPlayer::positionChanged); + connect(&mediaPlayer, &QMediaPlayer::durationChanged, this, &VideoPlayer::durationChanged); } VideoPlayer::~VideoPlayer() -- cgit v1.2.3