QWebViewSettings Class
Allows configuration of browser properties and attributes. More...
| Header: | #include <QWebViewSettings> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS WebView)target_link_libraries(mytarget PRIVATE Qt6::WebView) |
| qmake: | QT += webview |
| Since: | Qt 6.11 |
| Inherits: | QObject |
Public Types
| enum class | WebAttribute { LocalStorageEnabled, JavaScriptEnabled, AllowFileAccess, LocalContentCanAccessFileUrls } |
Public Functions
| void | setAttribute(QWebViewSettings::WebAttribute attribute, bool on) |
| bool | testAttribute(QWebViewSettings::WebAttribute attribute) const |
Detailed Description
The QWebViewSettings object can be used to configure browser properties and generic attributes, such as JavaScript support, file access and local storage features.
The default values are left as set by the different platforms.
Member Type Documentation
enum class QWebViewSettings::WebAttribute
This enum type specifies settings for web pages:
| Constant | Value | Description |
|---|---|---|
QWebViewSettings::WebAttribute::LocalStorageEnabled | 0 | Enables support for the HTML 5 local storage feature. |
QWebViewSettings::WebAttribute::JavaScriptEnabled | 1 | Enables the running of JavaScript programs. |
QWebViewSettings::WebAttribute::AllowFileAccess | 2 | Allows locally loaded documents to access other local URLs. |
QWebViewSettings::WebAttribute::LocalContentCanAccessFileUrls | 3 | Enables the WebView to load file URLs. |
Member Function Documentation
void QWebViewSettings::setAttribute(QWebViewSettings::WebAttribute attribute, bool on)
Enables or disables the specified attribute feature depending on the value of on.
bool QWebViewSettings::testAttribute(QWebViewSettings::WebAttribute attribute) const
Returns true if attribute is enabled; otherwise returns 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.