QWebEngineDesktopMediaRequest Class

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

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

公共函数

void cancel () const
QAbstractListModel * screensModel () const
void selectScreen (const QModelIndex & index ) const
void selectWindow (const QModelIndex & index ) const
QAbstractListModel * windowsModel () const

详细描述

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 () 或 selectWindow () to accept the request and start screensharing.

另请参阅 QWebEnginePage::desktopMediaRequested ().

成员函数文档编制

[invokable] void QWebEngineDesktopMediaRequest:: cancel () const

Rejects a request. Screen capturing will be aborted.

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

QAbstractListModel *QWebEngineDesktopMediaRequest:: screensModel () const

返回 QAbstractListModel for the available screens.

注意: Getter function for property screensModel.

另请参阅 windowsModel ().

[invokable] void QWebEngineDesktopMediaRequest:: selectScreen (const QModelIndex & index ) const

Selects the screen at the index to be captured.

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

另请参阅 QWebEngineDesktopMediaRequest::selectWindow ().

[invokable] void QWebEngineDesktopMediaRequest:: selectWindow (const QModelIndex & index ) const

Selects the window at the index to be captured.

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

另请参阅 QWebEngineDesktopMediaRequest::selectScreen ().

QAbstractListModel *QWebEngineDesktopMediaRequest:: windowsModel () const

返回 QAbstractListModel for the available windows.

注意: Getter function for property windowsModel.

另请参阅 screensModel ().