QWebEngineGlobalSettings Namespace

QWebEngineGlobalSettings 命名空间包含网络引擎的全局设置。更多

头文件: #include <QWebEngineGlobalSettings>
CMake: find_package(Qt6 REQUIRED COMPONENTS WebEngineCore)
target_link_libraries(mytarget PRIVATE Qt6::WebEngineCore)
qmake: QT += webenginecore
Qt 6.6

(since 6.6) struct DnsMode

类型

enum class SecureDnsMode { SystemOnly, SecureWithFallback, SecureOnly }

函数

bool setDnsMode(QWebEngineGlobalSettings::DnsMode dnsMode)

详细说明

QWebEngineGlobalSettings 命名空间包含网络引擎的全局属性。

调用setDnsMode() 配置 DNS-over-HTTPS。

另请参阅 QWebEngineGlobalSettings::setDnsMode() 。

DnsMode

DnsMode 结构提供了指定 DNS 主机解析模式的方法。更多

类型文档

enum class QWebEngineGlobalSettings::SecureDnsMode

该枚举用于设置DnsMode 结构使用的 DNS-over-HTTPS 模式:

常量说明
QWebEngineGlobalSettings::SecureDnsMode::SystemOnly0这是默认值。使用系统 DNS 主机解析。
QWebEngineGlobalSettings::SecureDnsMode::SecureWithFallback1启用 DNS-over-HTTPS (DoH)。DoH 服务器必须通过DnsMode 结构中的serverTemplates 提供。如果无法通过提供的服务器解析主机,则使用系统 DNS 主机解析。
QWebEngineGlobalSettings::SecureDnsMode::SecureOnly2启用 DNS-over-HTTPS,只允许以这种方式解析主机。必须通过DnsMode 结构中的serverTemplates 提供 DoH 服务器。如果 DNS-over-HTTPS 解析失败,则没有后备方案,DNS 主机解析会完全失败。

功能文档

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

为 DNS-over-HTTPS 主机解析设置dnsMode

如果DnsMode 结构中的serverTemplates 列表为空或包含无法为SecureDnsMode::SecureOnlySecureDnsMode::SecureWithFallback 解析的 URI 模板,则该函数返回false 。否则,它将返回true ,这意味着 DNS 模式变更已触发。

© 2025 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.