QWebViewSettings Class
允许配置浏览器属性和属性。更多
| Header: | #include <QWebViewSettings> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS WebView)target_link_libraries(mytarget PRIVATE Qt6::WebView) |
| qmake: | QT += webview |
| 自 | Qt 6.11 |
公共类型
| enum class | WebAttribute { LocalStorageEnabled, JavaScriptEnabled, AllowFileAccess, LocalContentCanAccessFileUrls } |
公共函数
| void | setAttribute(QWebViewSettings::WebAttribute attribute, bool on) |
| bool | testAttribute(QWebViewSettings::WebAttribute attribute) const |
成员类型文档
enum class QWebViewSettings::WebAttribute
该枚举类型用于指定网页设置:
| 常量 | 值 | 说明 |
|---|---|---|
QWebViewSettings::WebAttribute::LocalStorageEnabled | 0 | 启用对 HTML 5 本地存储功能的支持。 |
QWebViewSettings::WebAttribute::JavaScriptEnabled | 1 | 允许运行 JavaScript 程序。 |
QWebViewSettings::WebAttribute::AllowFileAccess | 2 | 允许本地加载的文档访问其他本地 URL。 |
QWebViewSettings::WebAttribute::LocalContentCanAccessFileUrls | 3 | 允许WebView 加载文件 URL。 |
成员函数文档
void QWebViewSettings::setAttribute(QWebViewSettings::WebAttribute attribute, bool on)
根据on 的值,启用或禁用指定的attribute 功能。
bool QWebViewSettings::testAttribute(QWebViewSettings::WebAttribute attribute) const
如果attribute 已启用,则返回true ;否则返回false 。
© 2026 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.