- Qt 6.9
- Qt WebEngine
- QWebEngineGlobalSettings Namespace
- Qt 6.9.3 Reference Documentation

# QWebEngineGlobalSettings Namespace

The QWebEngineGlobalSettings namespace holds global settings of the web engine. More...

Header: | `#include <QWebEngineGlobalSettings>`
CMake: | `find_package(Qt6 REQUIRED COMPONENTS WebEngineCore)` `target_link_libraries(mytarget PRIVATE Qt6::WebEngineCore)`
qmake: | `QT += webenginecore`
Since: | Qt 6.6

## Classes

`(since 6.6)` struct | DnsMode

## Types

enum class | SecureDnsMode { SystemOnly, SecureWithFallback, SecureOnly }

## Functions

bool | setDnsMode(QWebEngineGlobalSettings::DnsMode dnsMode)

## Detailed Description

The QWebEngineGlobalSettings namespace holds global properties of the web engine.

Invoke setDnsMode() to configure DNS-over-HTTPS.

See also QWebEngineGlobalSettings::setDnsMode().

## Classes

### class DnsMode

The DnsMode struct provides means to specify the DNS host resolution mode. More...

## Type Documentation

### enum class QWebEngineGlobalSettings::SecureDnsMode

This enum sets the DNS-over-HTTPS mode used by the DnsMode structure:

Constant | Value | Description
--- | --- | ---
`QWebEngineGlobalSettings::SecureDnsMode::SystemOnly` | `0` | This is the default. Use the system DNS host resolution.
`QWebEngineGlobalSettings::SecureDnsMode::SecureWithFallback` | `1` | Enable DNS-over-HTTPS (DoH). DoH servers have to be provided through serverTemplates in the DnsMode structure. If a host cannot be resolved via the provided servers, the system DNS host resolution is used.
`QWebEngineGlobalSettings::SecureDnsMode::SecureOnly` | `2` | Enable DNS-over-HTTPS and only allow hosts to be resolved this way. DoH servers have to be provided through serverTemplates in the DnsMode structure. If the DNS-over-HTTPS resolution fails, there is no fallback and the DNS host resolution fails completely.

## Function Documentation

### bool QWebEngineGlobalSettings::setDnsMode(QWebEngineGlobalSettings::DnsMode dnsMode)

Sets dnsMode for DNS-over-HTTPS host resolution.

This function returns `false` if the serverTemplates list in the DnsMode structure is empty or contains URI templates that cannot be parsed for SecureDnsMode::SecureOnly or SecureDnsMode::SecureWithFallback. Otherwise, it returns `true` meaning that the DNS mode change is triggered.