- Qt 6.11
- Qt WebView
- C++ Classes
- QWebViewSettings
- Qt 6.11.1 Reference Documentation

# 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

- List of all members, including inherited members

## 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`.