QWebEngineDesktopMediaRequest Class
请求在对话框中填充可用的屏幕捕捉源。更多
Header: | #include <QWebEngineDesktopMediaRequest> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS WebEngineCore) target_link_libraries(mytarget PRIVATE Qt6::WebEngineCore) |
qmake: | QT += webenginecore |
自 | 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 |
详细说明
为了让网络应用程序捕获显示屏的内容,应用程序必须连接到QWebEnginePage::desktopMediaRequested ,它将一个 QWebEngineDesktopMediaRequest 实例作为参数。
如果网络应用程序请求访问显示屏的内容,QWebEnginePage::desktopMediaRequested 将以 QWebEngineDesktopMediaRequest 实例为参数,其中包含对可用窗口和屏幕的 QAbstractListModels 引用。
数据模型的Qt::DisplayRole指定了源的名称,即窗口的标题或显示屏的编号。如果可用的源列表发生变化,例如窗口打开/关闭,模型就会动态更新。
信号处理程序随后需要调用selectScreen() 或selectWindow() 来接受请求并开始屏幕共享。
另请参阅 QWebEnginePage::desktopMediaRequested() 。
成员函数文档
[invokable]
void QWebEngineDesktopMediaRequest::cancel() const
拒绝请求。屏幕捕捉将中止。
注: 可通过元对象系统和 QML 调用此函数。请参阅Q_INVOKABLE 。
QAbstractListModel *QWebEngineDesktopMediaRequest::screensModel() const
返回可用屏幕的QAbstractListModel 。
注: 属性 screensModel 的获取函数。
另请参阅 windowsModel().
[invokable]
void QWebEngineDesktopMediaRequest::selectScreen(const QModelIndex &index) const
在index 上选择要捕捉的屏幕。
注: 可通过元对象系统和 QML 调用此功能。请参阅Q_INVOKABLE 。
另请参阅 QWebEngineDesktopMediaRequest::selectWindow() 。
[invokable]
void QWebEngineDesktopMediaRequest::selectWindow(const QModelIndex &index) const
在index 上选择要捕捉的窗口。
注: 可通过元对象系统和 QML 调用此函数。请参阅Q_INVOKABLE 。
另请参阅 QWebEngineDesktopMediaRequest::selectScreen() 。
QAbstractListModel *QWebEngineDesktopMediaRequest::windowsModel() const
返回可用窗口的QAbstractListModel 。
注: 属性 windowsModel 的获取函数。
另请参阅 screensModel().
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.