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 |
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 updates if the available list of sources has changed e.g a window is opened/closed.
The signal handler needs to then either call QWebEngineDesktopMediaRequest: selectScreen () 或 QWebEngineDesktopMediaRequest::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 for the available screens.
注意: Getter function for property screensModel.
另请参阅 windowsModel ().
[invokable]
void
QWebEngineDesktopMediaRequest::
selectScreen
(const
QModelIndex
&
index
) const
Selects the screen on the index to be captured.
注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .
另请参阅 QWebEngineDesktopMediaRequest::selectWindow ().
[invokable]
void
QWebEngineDesktopMediaRequest::
selectWindow
(const
QModelIndex
&
index
) const
Selects the window on the index to be captured.
注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .
另请参阅 QWebEngineDesktopMediaRequest::selectScreen ().
返回 QAbstractListModel for the available windows.
注意: Getter function for property windowsModel.
另请参阅 screensModel ().