Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
windowcapturesnippets.cpp
Go to the documentation of this file.
1// Copyright (C) 2026 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
4#include <QCapturableWindow>
5#include <QMediaCaptureSession>
6#include <QVideoWidget>
7#include <QWindowCapture>
8
9void wrapper0() {
10
11//! [Basic setup]
12QMediaCaptureSession session;
13QWindowCapture windowCapture;
14session.setWindowCapture(&windowCapture);
15
16QVideoWidget videoWidget;
17session.setVideoOutput(&videoWidget);
18videoWidget.show();
19
20// A window must be selected before capturing can start.
21const QList<QCapturableWindow> windows = QWindowCapture::capturableWindows();
22if (!windows.isEmpty()) {
23 windowCapture.setWindow(windows.first());
24 windowCapture.start();
25}
26//! [Basic setup]
27
28} // wrapper0()
void wrapper0()