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