refactor: Modernize Qt connections (#914)

This commit is contained in:
Murat Seker
2020-08-02 22:32:00 +02:00
committed by GitHub
parent d1a2b77ce3
commit 031b9a6b7c
22 changed files with 86 additions and 77 deletions

View File

@@ -357,7 +357,7 @@ bool V4L2Grabber::open_device()
// create the notifier for when a new frame is available
_streamNotifier = new QSocketNotifier(_fileDescriptor, QSocketNotifier::Read);
_streamNotifier->setEnabled(false);
connect(_streamNotifier, SIGNAL(activated(int)), this, SLOT(read_frame()));
connect(_streamNotifier, &QSocketNotifier::activated, this, &V4L2Grabber::read_frame);
return true;
}

View File

@@ -29,8 +29,8 @@ V4L2Wrapper::V4L2Wrapper(const QString &device,
qRegisterMetaType<Image<ColorRgb>>("Image<ColorRgb>");
// Handle the image in the captured thread using a direct connection
connect(&_grabber, SIGNAL(newFrame(Image<ColorRgb>)), this, SLOT(newFrame(Image<ColorRgb>)), Qt::DirectConnection);
connect(&_grabber, SIGNAL(readError(const char*)), this, SLOT(readError(const char*)), Qt::DirectConnection);
connect(&_grabber, &V4L2Grabber::newFrame, this, &V4L2Wrapper::newFrame, Qt::DirectConnection);
connect(&_grabber, &V4L2Grabber::readError, this, &V4L2Wrapper::readError, Qt::DirectConnection);
}
V4L2Wrapper::~V4L2Wrapper()