QWebEngineFullScreenRequest Class

QWebEngineFullScreenRequest 类可接受或拒绝进入或退出全屏模式的请求。更多

Header: #include <QWebEngineFullScreenRequest>
CMake: find_package(Qt6 REQUIRED COMPONENTS WebEngineCore)
target_link_libraries(mytarget PRIVATE Qt6::WebEngineCore)
qmake: QT += webenginecore
在 QML 中: FullScreenRequest

属性

公共功能

void accept()
QUrl origin() const
void reject()
bool toggleOn() const

详细说明

为允许在全屏模式下显示视频等元素,应用程序必须设置QWebEngineSettings::FullScreenSupportEnabled 并连接至QWebEnginePage::fullScreenRequested ,该函数以 QWebEngineFullScreenRequest 实例为参数。

如果网页中的某个元素请求以全屏模式显示,QWebEnginePage::fullScreenRequested 将以 QWebEngineFullScreenRequest 实例作为参数,其中toggleOn() 返回true 。信号处理程序随后需要调用accept() 或reject() 。

如果进入全屏模式的请求被接受,请求全屏模式的元素将填满视口,但能否使视图全屏或将页面移动到全屏模式下的视图则取决于应用程序。

同样,当用户想离开全屏模式(即通过QWebEnginePage::ExitFullScreen 上下文菜单操作)时,也会发出QWebEnginePage::fullScreenRequested 。在这种情况下,toggleOn() 将返回false ,信号处理程序需要再次accept() 或reject() 请求。如果请求被接受,应用程序需要确保恢复全局窗口状态。

属性文档

[read-only] origin : const QUrl

该属性用于保存要在全屏模式下打开的 URL。

访问功能:

QUrl origin() const

[read-only] toggleOn : const bool

此属性表示网页是否已发出进入全屏模式的请求。

访问函数:

bool toggleOn() const

成员函数文档

[invokable] void QWebEngineFullScreenRequest::accept()

接受进入或退出全屏模式的请求。

注: 可通过元对象系统和 QML 调用此函数。请参阅Q_INVOKABLE

QUrl QWebEngineFullScreenRequest::origin() const

返回要在全屏模式下打开的 URL。

注: 属性 origin 的获取函数。

[invokable] void QWebEngineFullScreenRequest::reject()

拒绝进入或退出全屏模式的请求。

注: 可通过元对象系统和 QML 调用此函数。请参阅Q_INVOKABLE

bool QWebEngineFullScreenRequest::toggleOn() const

如果网页已发出进入全屏模式的请求,则返回true ,否则返回false

注: 属性 toggleOn 的获取函数。

© 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.