- Qt 6.8
- Qt WebEngine
- C++ Classes
- QtWebEngineCore
- QWebEngineDesktopMediaRequest
- Qt 6.8.3 Reference Documentation

# QWebEngineDesktopMediaRequest Class

A request for populating a dialog with available sources for screen capturing. More...

Header: | `#include <QWebEngineDesktopMediaRequest>`
CMake: | `find_package(Qt6 REQUIRED COMPONENTS WebEngineCore)` `target_link_libraries(mytarget PRIVATE Qt6::WebEngineCore)`
qmake: | `QT += webenginecore`
Since: | Qt 6.7
In QML: | WebEngineDesktopMediaRequest

## Detailed Description

To allow web applications to capture contents of a display, applications must connect to QWebEnginePage::desktopMediaRequested, which takes a QWebEngineDesktopMediaRequest instance as an argument.

If a web application requests access to the contents of a display, QWebEnginePage::desktopMediaRequested will be emitted with a QWebEngineDesktopMediaRequest instance as an argument which holds references to QAbstractListModels for available windows and screens that can be captured.

The data model's Qt::DisplayRole specifies the name of the source which is the title of a window or the number of the display. The model is dynamically updated if the available list of sources has changed; e.g when a window is opened/closed.

The signal handler needs to then either call selectScreen() or selectWindow() to accept the request and start screensharing.

See also QWebEnginePage::desktopMediaRequested().