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