78QWindowCapture::QWindowCapture(QObject *parent) : QObject(*
new QWindowCapturePrivate, parent)
82 qRegisterMetaType<QCapturableWindow>();
84 auto platformCapture = QPlatformMediaIntegration::instance()->createWindowCapture(
this);
86 if (platformCapture) {
87 connect(platformCapture, &QPlatformSurfaceCapture::activeChanged,
this,
88 &QWindowCapture::activeChanged);
89 connect(platformCapture, &QPlatformSurfaceCapture::errorChanged,
this,
90 &QWindowCapture::errorChanged);
91 connect(platformCapture, &QPlatformSurfaceCapture::errorOccurred,
this,
92 [
this](QPlatformSurfaceCapture::Error error,
const QString &errorString) {
93 emit errorOccurred(toWindowCaptureError(error), errorString);
95 connect(platformCapture,
96 qOverload<QCapturableWindow>(&QPlatformSurfaceCapture::sourceChanged),
this,
97 &QWindowCapture::windowChanged);
99 connect(platformCapture, &QPlatformSurfaceCapture::frameRateChanged,
this,
100 &QWindowCapture::frameRateChanged);
102 d->platformWindowCapture.reset(platformCapture);