- Qt 6.10
- Qt WebEngine
- QML Types
- webEngineDesktopMediaRequest
- Qt 6.10.1 Reference Documentation

# webEngineDesktopMediaRequest QML Value 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

## 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 value 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().