PySide6.QtWebEngineCore.QWebEngineProfileBuilder

class QWebEngineProfileBuilder

The QWebEngineProfileBuilder class provides a way to construct QWebEngineProfile . More

Added in version 6.9.

Synopsis

Methods

Static functions

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

Detailed Description

A QWebEngineProfileBuilder creates an instance of 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.

__init__()
static createOffTheRecordProfile([parent=None])
Parameters:

parentQObject

Return type:

QWebEngineProfile

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

createProfile(storageName[, parent=None])
Parameters:
  • storageName – str

  • parentQObject

Return type:

QWebEngineProfile

Constructs a profile with the storage name storageName and parent 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.

Note

When creating a disk-based profile, if the data path is already in use by another profile, the function will return a null pointer.

See also

storageName()

setCachePath(path)
Parameters:

path – str

Return type:

QWebEngineProfileBuilder

Sets the path used for the cache to path.

By default, this is below StandardPaths::CacheLocation in a QtWebengine/StorageName specific subdirectory.

Note

Use QStandardPaths::writableLocation(QStandardPaths::CacheLocation) to obtain the QStandardPaths::CacheLocation path.

setHttpCacheMaximumSize(maxSizeInBytes)
Parameters:

maxSizeInBytes – int

Return type:

QWebEngineProfileBuilder

Sets the maximum size of the HTTP cache to maxSizeInBytes bytes.

Setting it to 0 means the size will be controlled automatically by QtWebEngine .

setHttpCacheType(httpCacheType)
Parameters:

httpCacheTypeHttpCacheType

Return type:

QWebEngineProfileBuilder

Sets the HTTP cache type to httpCacheType.

setPersistentCookiesPolicy(persistentCookiesPolicy)
Parameters:

persistentCookiesPolicyPersistentCookiesPolicy

Return type:

QWebEngineProfileBuilder

Sets the policy for persistent cookies to persistentCookiePolicy.

setPersistentPermissionsPolicy(persistentPermissionPolicy)
Parameters:

persistentPermissionPolicyPersistentPermissionsPolicy

Return type:

QWebEngineProfileBuilder

Sets the policy for persistent permissions to persistentPermissionPolicy.

setPersistentStoragePath(path)
Parameters:

path – str

Return type:

QWebEngineProfileBuilder

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.

Note

Use QStandardPaths::writableLocation(QStandardPaths::DataLocation) to obtain the QStandardPaths::DataLocation path.