65QScreenCapture::QScreenCapture(QObject *parent)
66 : QObject(*
new QScreenCapturePrivate, parent)
70 auto platformCapture = QPlatformMediaIntegration::instance()->createScreenCapture(
this);
71 if (platformCapture) {
72 connect(platformCapture, &QPlatformSurfaceCapture::activeChanged,
this,
73 &QScreenCapture::activeChanged);
74 connect(platformCapture, &QPlatformSurfaceCapture::errorChanged,
this,
75 &QScreenCapture::errorChanged);
76 connect(platformCapture, &QPlatformSurfaceCapture::errorOccurred,
this,
77 [
this](QPlatformSurfaceCapture::Error error,
const QString &errorString) {
78 emit errorOccurred(toScreenCaptureError(error), errorString);
81 connect(platformCapture,
82 qOverload<QPlatformSurfaceCapture::ScreenSource>(
83 &QPlatformSurfaceCapture::sourceChanged),
84 this, &QScreenCapture::screenChanged);
86 connect(platformCapture, &QPlatformSurfaceCapture::frameRateChanged,
this,
87 &QScreenCapture::maximumFrameRateChanged);
89 d->platformScreenCapture.reset(platformCapture);