78QScreenCapture::QScreenCapture(QObject *parent)
79 : QObject(*
new QScreenCapturePrivate, parent)
83 auto platformCapture = QPlatformMediaIntegration::instance()->createScreenCapture(
this);
84 if (platformCapture) {
85 connect(platformCapture, &QPlatformSurfaceCapture::activeChanged,
this,
86 &QScreenCapture::activeChanged);
87 connect(platformCapture, &QPlatformSurfaceCapture::errorChanged,
this,
88 &QScreenCapture::errorChanged);
89 connect(platformCapture, &QPlatformSurfaceCapture::errorOccurred,
this,
90 [
this](QPlatformSurfaceCapture::Error error, QString errorString) {
91 emit errorOccurred(toScreenCaptureError(error), errorString);
94 connect(platformCapture,
95 qOverload<QPlatformSurfaceCapture::ScreenSource>(
96 &QPlatformSurfaceCapture::sourceChanged),
97 this, &QScreenCapture::screenChanged);
99 d->platformScreenCapture.reset(platformCapture);