The QWebEngineProfileBuilder class provides a way to construct QWebEngineProfile . 更多...
| 头: |
#include <QWebEngineProfileBuilder>
|
| CMake: |
find_package(Qt6 REQUIRED COMPONENTS WebEngineCore)
target_link_libraries(mytarget PRIVATE Qt6::WebEngineCore)
|
| qmake: |
QT += webenginecore
|
| Since: | Qt 6.9 |
| QWebEngineProfile * | createProfile (const QString & storageName , QObject * parent = nullptr) const |
(从 6.10 起)
QWebEngineProfileBuilder &
|
setAdditionalTrustedCertificates (const QList<QSslCertificate> & certificates ) |
| QWebEngineProfileBuilder & | setCachePath (const QString & path ) |
| QWebEngineProfileBuilder & | setHttpCacheMaximumSize (int maxSizeInBytes ) |
| QWebEngineProfileBuilder & | setHttpCacheType (QWebEngineProfile::HttpCacheType httpCacheType ) |
| QWebEngineProfileBuilder & | setPersistentCookiesPolicy (QWebEngineProfile::PersistentCookiesPolicy persistentCookiePolicy ) |
| QWebEngineProfileBuilder & | setPersistentPermissionsPolicy (QWebEngineProfile::PersistentPermissionsPolicy persistentPermissionPolicy ) |
| QWebEngineProfileBuilder & | setPersistentStoragePath (const QString & path ) |
| QWebEngineProfile * | createOffTheRecordProfile (QObject * parent = nullptr) |
A QWebEngineProfileBuilder 创建实例为 QWebEngineProfile class. Some profile's properties have to be initialized in one call and should not be modified during profile lifetime. The web engine profile builder simply guards that.
[static]
QWebEngineProfile
*QWebEngineProfileBuilder::
createOffTheRecordProfile
(
QObject
*
parent
= nullptr)
Creates an off-the-record profile with the parent object parent that leaves no record on the local machine and has no persistent data or cache. This will force cookies, persistent data and HTTP cache to be stored in memory
Constructs a profile with the storage name storageName 和父级 parent .
The storage name is used to give each disk-based profile, a separate subdirectory for persistent data and cache. The storage location must be unique during application life time. It is up to the user to prevent the creation of profiles with same storage's location, which can lead to corrupted browser cache.
A disk-based QWebEngineProfile should be destroyed before the application exit, otherwise the cache and persistent data may not be fully flushed to disk.
注意: When creating a disk-based profile, if the data path is already in use by another profile, the function will return a null pointer.
另请参阅 QWebEngineProfile::storageName ().
[since 6.10]
QWebEngineProfileBuilder
&QWebEngineProfileBuilder::
setAdditionalTrustedCertificates
(const
QList
<
QSslCertificate
> &
certificates
)
Sets additional certificates for this profile's CA certificate database to certificates .
该函数在 Qt 6.10 引入。
Sets the path used for the cache to path .
默认情况下,这位于 QtWebengine/StorageName 特定子目录中 StandardPaths::CacheLocation 下。
注意: 使用 QStandardPaths::writableLocation ( QStandardPaths::CacheLocation ) 以获得 QStandardPaths::CacheLocation 路径。
另请参阅 QWebEngineProfile::cachePath () 和 QStandardPaths::writableLocation ().
把 HTTP 缓存的最大尺寸设为 maxSizeInBytes 字节。
把它设为
0
意味着尺寸将被自动控制由
QtWebEngine
.
另请参阅 QWebEngineProfile::httpCacheMaximumSize () 和 setHttpCacheType ().
把 HTTP 缓存类型设为 httpCacheType .
另请参阅 QWebEngineProfile::httpCacheType () 和 setCachePath ().
把持久 Cookie 策略设为 persistentCookiePolicy .
另请参阅 QWebEngineProfile::persistentCookiesPolicy ().
Sets the policy for persistent permissions to persistentPermissionPolicy .
另请参阅 QWebEngineProfile::persistentPermissionsPolicy ().
Sets the path used to store persistent data for the browser and web content to path . Persistent data includes persistent cookies, HTML5 local storage, and visited links.
By default, this is below QStandardPaths::DataLocation in a QtWebengine/StorageName specific subdirectory.
注意: 使用 QStandardPaths::writableLocation (QStandardPaths::DataLocation) to obtain the QStandardPaths::DataLocation path.
另请参阅 QWebEngineProfile::persistentStoragePath () 和 QStandardPaths::writableLocation ().