QWebViewSettings Class
允许配置浏览器的属性和特征。更多...
| 标题: | #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 | 启用WebView 加载文件URL。 |
QWebViewSettings::WebAttribute::LocalContentCanAccessFileUrls | 3 | 允许本地加载的文档访问其他本地 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.