QQuickWebEngineProfile

The QQuickWebEngineProfile class provides a web engine profile shared by multiple pages. More

Inheritance diagram of PySide6.QtWebEngineQuick.QQuickWebEngineProfile

Synopsis

Functions

Static functions

Detailed Description

A web engine profile contains settings, scripts, persistent cookie policy, and the list of visited links shared by all web engine pages that belong to the profile.

Information about visited links is stored together with persistent cookies and other persistent data in a storage determined by the storageName property. Persistent data is stored in a subdirectory determined by the persistentStoragePath property and the cache in a subdirectory determined by the cachePath property. The httpCacheType property describes the type of the cache: in-memory or on-disk. If only the storageName property is set, the other values are generated automatically based on it. If you specify any of the values manually, you should do it before creating any pages that belong to the profile.

Profiles can be used to isolate pages from each other. A typical use case is a dedicated off-the-record profile for a private browsing mode. An off-the-record profile forces cookies, the HTTP cache, and other normally persistent data to be stored only in memory. The offTheRecord property holds whether a profile is off-the-record.

The default profile can be accessed by defaultProfile() . It is a built-in profile that all web pages not specifically created with another profile belong to.

A WebEngineProfile instance can be created and accessed from C++ through the QQuickWebEngineProfile class, which exposes further functionality in C++. This allows Qt Quick applications to intercept URL requests (QQuickWebEngineProfile::setRequestInterceptor), or register custom URL schemes ( installUrlSchemeHandler ).

Spellchecking HTML form fields can be enabled per profile by setting the spellCheckEnabled property and the current languages used for spellchecking can be set by using the spellCheckLanguages property.

class PySide6.QtWebEngineQuick.QQuickWebEngineProfile([parent=None])
Parameters

parentPySide6.QtCore.QObject

Constructs a new profile with the parent parent.

PySide6.QtWebEngineQuick.QQuickWebEngineProfile.HttpCacheType

This enum describes the HTTP cache type:

Constant

Description

QQuickWebEngineProfile.MemoryHttpCache

Use an in-memory cache. This is the default if off-the-record is set.

QQuickWebEngineProfile.DiskHttpCache

Use a disk cache. This is the default if off-the-record is not set. Falls back to MemoryHttpCache if off-the-record is set.

QQuickWebEngineProfile.NoCache

Disable both in-memory and disk caching. (Added in Qt 5.7)

PySide6.QtWebEngineQuick.QQuickWebEngineProfile.PersistentCookiesPolicy

This enum describes policy for cookie persistency:

Constant

Description

QQuickWebEngineProfile.NoPersistentCookies

Both session and persistent cookies are stored in memory. This is the only setting possible if off-the-record is set or no persistent data path is available.

QQuickWebEngineProfile.AllowPersistentCookies

Cookies marked persistent are saved to and restored from disk, whereas session cookies are only stored to disk for crash recovery. This is the default setting.

QQuickWebEngineProfile.ForcePersistentCookies

Both session and persistent cookies are saved to and restored from disk.

PySide6.QtWebEngineQuick.QQuickWebEngineProfile.cachePath()
Return type

str

See also

setCachePath()

PySide6.QtWebEngineQuick.QQuickWebEngineProfile.cachePathChanged()
PySide6.QtWebEngineQuick.QQuickWebEngineProfile.clearHttpCache()

Removes the profile’s cache entries.

See also

clearHttpCache

PySide6.QtWebEngineQuick.QQuickWebEngineProfile.cookieStore()
Return type

PySide6.QtWebEngineCore.QWebEngineCookieStore

Returns the cookie store for this profile.

static PySide6.QtWebEngineQuick.QQuickWebEngineProfile.defaultProfile()
Return type

PySide6.QtWebEngineQuick.QQuickWebEngineProfile

Returns the default profile.

The default profile uses the storage name “Default”.

See also

storageName()

PySide6.QtWebEngineQuick.QQuickWebEngineProfile.downloadPath()
Return type

str

PySide6.QtWebEngineQuick.QQuickWebEngineProfile.downloadPathChanged()
PySide6.QtWebEngineQuick.QQuickWebEngineProfile.httpAcceptLanguage()
Return type

str

PySide6.QtWebEngineQuick.QQuickWebEngineProfile.httpAcceptLanguageChanged()
PySide6.QtWebEngineQuick.QQuickWebEngineProfile.httpCacheMaximumSize()
Return type

int

PySide6.QtWebEngineQuick.QQuickWebEngineProfile.httpCacheMaximumSizeChanged()
PySide6.QtWebEngineQuick.QQuickWebEngineProfile.httpCacheType()
Return type

HttpCacheType

PySide6.QtWebEngineQuick.QQuickWebEngineProfile.httpCacheTypeChanged()
PySide6.QtWebEngineQuick.QQuickWebEngineProfile.httpUserAgent()
Return type

str

PySide6.QtWebEngineQuick.QQuickWebEngineProfile.httpUserAgentChanged()
PySide6.QtWebEngineQuick.QQuickWebEngineProfile.installUrlSchemeHandler(scheme, arg__2)
Parameters

Registers a handler handler for custom URL scheme scheme in the profile.

It is necessary to first register the scheme with registerScheme at application startup.

PySide6.QtWebEngineQuick.QQuickWebEngineProfile.isOffTheRecord()
Return type

bool

PySide6.QtWebEngineQuick.QQuickWebEngineProfile.isSpellCheckEnabled()
Return type

bool

PySide6.QtWebEngineQuick.QQuickWebEngineProfile.offTheRecordChanged()
PySide6.QtWebEngineQuick.QQuickWebEngineProfile.persistentCookiesPolicy()
Return type

PersistentCookiesPolicy

PySide6.QtWebEngineQuick.QQuickWebEngineProfile.persistentCookiesPolicyChanged()
PySide6.QtWebEngineQuick.QQuickWebEngineProfile.persistentStoragePath()
Return type

str

PySide6.QtWebEngineQuick.QQuickWebEngineProfile.persistentStoragePathChanged()
PySide6.QtWebEngineQuick.QQuickWebEngineProfile.presentNotification(notification)
Parameters

notificationPySide6.QtWebEngineCore.QWebEngineNotification

This signal is emitted whenever there is a newly created user notification. The notification argument holds the QWebEngineNotification instance to query data and interact with.

See also

presentNotification

PySide6.QtWebEngineQuick.QQuickWebEngineProfile.removeAllUrlSchemeHandlers()

Removes all custom URL scheme handlers installed in the profile.

PySide6.QtWebEngineQuick.QQuickWebEngineProfile.removeUrlScheme(scheme)
Parameters

schemePySide6.QtCore.QByteArray

Removes the custom URL scheme scheme from the profile.

PySide6.QtWebEngineQuick.QQuickWebEngineProfile.removeUrlSchemeHandler(arg__1)
Parameters

arg__1PySide6.QtWebEngineCore.QWebEngineUrlSchemeHandler

Removes the custom URL scheme handler handler from the profile.

PySide6.QtWebEngineQuick.QQuickWebEngineProfile.setCachePath(path)
Parameters

path – str

See also

cachePath()

PySide6.QtWebEngineQuick.QQuickWebEngineProfile.setDownloadPath(path)
Parameters

path – str

See also

downloadPath()

PySide6.QtWebEngineQuick.QQuickWebEngineProfile.setHttpAcceptLanguage(httpAcceptLanguage)
Parameters

httpAcceptLanguage – str

PySide6.QtWebEngineQuick.QQuickWebEngineProfile.setHttpCacheMaximumSize(maxSize)
Parameters

maxSize – int

PySide6.QtWebEngineQuick.QQuickWebEngineProfile.setHttpCacheType(arg__1)
Parameters

arg__1HttpCacheType

See also

httpCacheType()

PySide6.QtWebEngineQuick.QQuickWebEngineProfile.setHttpUserAgent(userAgent)
Parameters

userAgent – str

See also

httpUserAgent()

PySide6.QtWebEngineQuick.QQuickWebEngineProfile.setOffTheRecord(offTheRecord)
Parameters

offTheRecord – bool

See also

isOffTheRecord()

PySide6.QtWebEngineQuick.QQuickWebEngineProfile.setPersistentCookiesPolicy(arg__1)
Parameters

arg__1PersistentCookiesPolicy

PySide6.QtWebEngineQuick.QQuickWebEngineProfile.setPersistentStoragePath(path)
Parameters

path – str

PySide6.QtWebEngineQuick.QQuickWebEngineProfile.setSpellCheckEnabled(enabled)
Parameters

enabled – bool

PySide6.QtWebEngineQuick.QQuickWebEngineProfile.setSpellCheckLanguages(languages)
Parameters

languages – list of strings

PySide6.QtWebEngineQuick.QQuickWebEngineProfile.setStorageName(name)
Parameters

name – str

See also

storageName()

PySide6.QtWebEngineQuick.QQuickWebEngineProfile.setUrlRequestInterceptor(interceptor)
Parameters

interceptorPySide6.QtWebEngineCore.QWebEngineUrlRequestInterceptor

Registers a request interceptor singleton interceptor to intercept URL requests.

The profile does not take ownership of the pointer.

See also

QWebEngineUrlRequestInfo QWebEngineUrlRequestInterceptor

PySide6.QtWebEngineQuick.QQuickWebEngineProfile.spellCheckEnabledChanged()
PySide6.QtWebEngineQuick.QQuickWebEngineProfile.spellCheckLanguages()
Return type

list of strings

Returns the list of languages used by the spell checker.

PySide6.QtWebEngineQuick.QQuickWebEngineProfile.spellCheckLanguagesChanged()
PySide6.QtWebEngineQuick.QQuickWebEngineProfile.storageName()
Return type

str

See also

setStorageName()

PySide6.QtWebEngineQuick.QQuickWebEngineProfile.storageNameChanged()
PySide6.QtWebEngineQuick.QQuickWebEngineProfile.urlSchemeHandler(arg__1)
Parameters

arg__1PySide6.QtCore.QByteArray

Return type

PySide6.QtWebEngineCore.QWebEngineUrlSchemeHandler

Returns the custom URL scheme handler register for the URL scheme scheme.