- Qt 6.9
- Qt WebEngine
- QML Types
- WebEngineDesktopMediaRequest
- Qt 6.9.1 Reference Documentation

# WebEngineDesktopMediaRequest QML Type

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

Import Statement: | `import QtWebEngine`
Since: | Qt 6.7
In C++: | QWebEngineDesktopMediaRequest

- List of all members, including inherited members

## Properties

- screensModel : ListModel
- windowsModel : ListModel

## Methods

- void cancel()
- void selectScreen(QModelIndex index)
- void selectWindow(QModelIndex index)

## Detailed Description

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

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

The data model's 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 WebEngineView::desktopMediaRequested.

## Property Documentation

screensModel : ListModel

A ListModel containing a list of available screens.

See also windowsModel.

windowsModel : ListModel

A ListModel containing a list of available windows.

See also screensModel.

## Method Documentation

void cancel()

Rejects a request. Screen capturing will be aborted.

void selectScreen(QModelIndex index)

Selects the screen at the index to be captured.

See also WebEngineDesktopMediaRequest::selectWindow().

void selectWindow(QModelIndex index)

Selects the window at the index to be captured.

See also WebEngineDesktopMediaRequest::selectScreen().