PySide6.QtWebEngineQuick.QQuickWebEngineProfile¶
- class QQuickWebEngineProfile¶
- The - QQuickWebEngineProfileclass provides a web engine profile shared by multiple pages. More…- Synopsis¶- Properties¶
- spellCheckEnabledᅟ- Whether the web engine spell checker is enabled
- spellCheckLanguagesᅟ- Languages used by the spell checker
 - Methods¶- def - __init__()
- def - cachePath()
- def - clearHttpCache()
- def - clientHints()
- def - cookieStore()
- def - downloadPath()
- def - httpCacheType()
- def - httpUserAgent()
- def - isOffTheRecord()
- def - setCachePath()
- def - setStorageName()
- def - storageName()
 - Signals¶- Static functions¶- def - defaultProfile()
 - 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 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 - storageNameproperty. Persistent data is stored in a subdirectory determined by the- persistentStoragePathproperty and the cache in a subdirectory determined by the- cachePathproperty. The- httpCacheTypeproperty describes the type of the cache: in-memory or on-disk. If only the- storageNameproperty 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 - offTheRecordproperty 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 - QQuickWebEngineProfileclass, 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 - spellCheckEnabledproperty and the current languages used for spellchecking can be set by using the- spellCheckLanguagesproperty.- class HttpCacheType¶
- This enum describes the HTTP cache type: - Constant - Description - QQuickWebEngineProfile.MemoryHttpCache - Use an in-memory cache. This is the default if - off-the-recordis set.- QQuickWebEngineProfile.DiskHttpCache - Use a disk cache. This is the default if - off-the-recordis not set. Falls back to- MemoryHttpCacheif- off-the-recordis set.- QQuickWebEngineProfile.NoCache - Disable both in-memory and disk caching. (Added in Qt 5.7) 
 - class 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-recordis 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. 
 - class PersistentPermissionsPolicy¶
- This enum describes the policy for permission persistence: - Constant - Description - QQuickWebEngineProfile.PersistentPermissionsPolicy.AskEveryTime - The application will ask for permissions every time they’re needed, regardless of whether they’ve been granted before or not. This is intended for backwards compatibility with existing applications, and otherwise not recommended. - QQuickWebEngineProfile.PersistentPermissionsPolicy.StoreInMemory - A request will be made only the first time a permission is needed. Any subsequent requests will be automatically granted or denied, depending on the initial user choice. This carries over to all pages that use the same - QQuickWebEngineProfileinstance, until the application is shut down. This is the setting applied if- off-the-recordis set or no persistent data path is available.- QQuickWebEngineProfile.PersistentPermissionsPolicy.StoreOnDisk - Works the same way as - PersistentPermissionsInMemory, but the permissions are saved to and restored from disk. This is the default setting.- Added in version 6.8. 
 - Note - Properties can be used directly when - from __feature__ import true_propertyis used or via accessor functions otherwise.- property cachePathᅟ: str¶
 - The path to the location where the profile’s caches are stored, in particular the HTTP cache. - By default, the caches are stored below QStandardPaths::writableLocation(QStandardPaths::CacheLocation) in a directory named using - storageName.- Access functions:
 - property clientHintsᅟ: QWebEngineClientHints¶
 - Access functions:
 - property downloadPathᅟ: str¶
 - The path to the location where the downloaded files are stored. - Overrides the default path used for download location, setting it to - path.- If set to an empty string, the default path is restored. - Note - By default, the download path is QStandardPaths::DownloadLocation. - Access functions:
 - property httpAcceptLanguageᅟ: str¶
 - The value of the Accept-Language HTTP request-header field. - Access functions:
 - property httpCacheMaximumSizeᅟ: int¶
 - The maximum size of the HTTP cache. If - 0, the size will be controlled automatically by QtWebEngine . The default value is- 0.- See also - Access functions:
 - property httpCacheTypeᅟ: QQuickWebEngineProfile.HttpCacheType¶
 - This enumeration describes the type of the HTTP cache. - If the profile is off-the-record or has no - storageNameset,- MemoryHttpCacheis returned.- Access functions:
 - property httpUserAgentᅟ: str¶
 - The user-agent string sent with HTTP to identify the browser. - Access functions:
 - property isPushServiceEnabledᅟ: bool¶
 - Whether the push messaging service is enabled. - Note - By default the push messaging service is disabled. - Note - Qt WebEngine uses the Firebase Cloud Messaging (FCM) as a browser push service. Therefore, all push messages will go through the Google push service and its respective servers. - Access functions:
 - property offTheRecordᅟ: bool¶
 - Whether the web engine profile is off-the-record. An off-the-record profile forces cookies, the HTTP cache, and other normally persistent data to be stored only in memory. Profile is off-the-record by default. - Changing a profile from off-the-record to disk-based behavior also requires setting a proper - storageName.- See also - Access functions:
 - property persistentCookiesPolicyᅟ: QQuickWebEngineProfile.PersistentCookiesPolicy¶
 - This enumeration describes the policy of cookie persistency. If the profile is off-the-record, - NoPersistentCookiesis returned.- Access functions:
 - property persistentPermissionsPolicyᅟ: QQuickWebEngineProfile.PersistentPermissionsPolicy¶
 - Describes the policy of permission persistence. If the profile is off-the-record, - NoPersistentCookiesis returned.- Access functions:
 - property persistentStoragePathᅟ: str¶
 - The path to the location where the persistent data for the browser and web content are stored. Persistent data includes persistent cookies, HTML5 local storage, and visited links. - By default, the storage is located below QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) in a directory named using - storageName.- Access functions:
 - property spellCheckEnabledᅟ: bool¶
 - This property holds whether the web engine spell checker is enabled.. - Access functions:
 - property spellCheckLanguagesᅟ: list of strings¶
 - This property holds The languages used by the spell checker.. - Access functions:
 - property storageNameᅟ: str¶
 - The storage name that is used to create separate subdirectories for each profile that uses the disk for storing persistent data and cache. - See also - Access functions:
 - Constructs a new off-the-record profile with the parent - parent.- An off-the-record profile leaves no record on the local machine, and has no persistent data or cache. Thus, the HTTP cache can only be in memory and the cookies can only be non-persistent. Trying to change these settings will have no effect. - cachePath()¶
- Return type:
- str 
 - See also 
 - Getter of property - cachePathᅟ.- cachePathChanged()¶
 - Notification signal of property - cachePathᅟ.- clearHttpCache()¶
 - Removes the profile’s cache entries. - Note - Make sure that you do not start new navigation or any operation on the profile while the clear operation is in progress. The - clearHttpCacheCompleted()signal notifies about the completion.- See also - clearHttpCache()- clearHttpCacheCompleted()- clearHttpCacheCompleted()¶
 - This signal is emitted when the - clearHttpCache()operation is completed.- See also - clientCertificateStore()¶
- Return type:
 
 - Returns the profile’s client certificate store. - clientHints()¶
- Return type:
 
 - Return the Client Hints settings associated with this browsing context. - See also - Getter of property - clientHintsᅟ.- cookieStore()¶
- Return type:
 
 - Returns the cookie store for this profile. - static defaultProfile()¶
- Return type:
 
 - Returns the default profile. - The default profile is off-the-record. - See also - downloadPath()¶
- Return type:
- str 
 - See also 
 - Getter of property - downloadPathᅟ.- downloadPathChanged()¶
 - Notification signal of property - downloadPathᅟ.- httpAcceptLanguage()¶
- Return type:
- str 
 - See also 
 - Getter of property - httpAcceptLanguageᅟ.- httpAcceptLanguageChanged()¶
 - Notification signal of property - httpAcceptLanguageᅟ.- httpCacheMaximumSize()¶
- Return type:
- int 
 - See also 
 - Getter of property - httpCacheMaximumSizeᅟ.- httpCacheMaximumSizeChanged()¶
 - Notification signal of property - httpCacheMaximumSizeᅟ.- httpCacheType()¶
- Return type:
 - See also 
 - Getter of property - httpCacheTypeᅟ.- httpCacheTypeChanged()¶
 - Notification signal of property - httpCacheTypeᅟ.- httpUserAgent()¶
- Return type:
- str 
 - See also 
 - Getter of property - httpUserAgentᅟ.- httpUserAgentChanged()¶
 - Notification signal of property - httpUserAgentᅟ.- installUrlSchemeHandler(scheme, handler)¶
- Parameters:
- scheme – - QByteArray
- handler – - QWebEngineUrlSchemeHandler
 
 
 - Registers a handler - handlerfor custom URL scheme- schemein the profile.- It is necessary to first register the scheme with - registerSchemeat application startup.- isOffTheRecord()¶
- Return type:
- bool 
 
 - Getter of property - offTheRecordᅟ.- isPushServiceEnabled()¶
- Return type:
- bool 
 
 - Getter of property - isPushServiceEnabledᅟ.- isSpellCheckEnabled()¶
- Return type:
- bool 
 
 - Getter of property - spellCheckEnabledᅟ.- listAllPermissions()¶
- Return type:
- .list of QWebEnginePermission 
 
 - Returns a QList of - QWebEnginePermissionobjects, each one representing a single permission currently present in the permissions store. The returned list contains all previously granted/denied permissions for this profile, provided they are of a persistent type.- Note - When persistentPermissionPolicy() is set to - AskEveryTime, this will return an empty list.- listPermissionsForOrigin(securityOrigin)¶
- Parameters:
- securityOrigin – - QUrl
- Return type:
- .list of QWebEnginePermission 
 
 - Returns a QList of - QWebEnginePermissionobjects, each one representing a single permission currently present in the permissions store. The returned list contains all previously granted/denied permissions associated with a specific- securityOriginfor this profile, provided they are of a persistent type.- Note - Since permissions are granted on a per-origin basis, the provided - securityOriginwill be stripped to its origin form, and the returned list will contain all permissions for the origin. Thus, passing https://www.example.com/some/page.html is the same as passing just https://www.example.com/.- listPermissionsForPermissionType(permissionType)¶
- Parameters:
- permissionType – - PermissionType
- Return type:
- .list of QWebEnginePermission 
 
 - Returns a QList of - QWebEnginePermissionobjects, each one representing a single permission currently present in the permissions store. The returned list contains all previously granted/denied permissions of the provided- permissionType. If the permissionType is non-persistent, the list will be empty.- Note - When persistentPermissionPolicy() is set to - AskEveryTime, this will return an empty list.- See also - queryPermission()- listAllPermissions()- listPermissionsForOrigin()- PermissionType- isPersistent()- offTheRecordChanged()¶
 - Notification signal of property - offTheRecordᅟ.- persistentCookiesPolicy()¶
- Return type:
 - See also 
 - Getter of property - persistentCookiesPolicyᅟ.- persistentCookiesPolicyChanged()¶
 - Notification signal of property - persistentCookiesPolicyᅟ.- persistentPermissionsPolicy()¶
- Return type:
 - See also 
 - Getter of property - persistentPermissionsPolicyᅟ.- persistentPermissionsPolicyChanged()¶
 - Notification signal of property - persistentPermissionsPolicyᅟ.- persistentStoragePath()¶
- Return type:
- str 
 - See also 
 - Getter of property - persistentStoragePathᅟ.- persistentStoragePathChanged()¶
 - Notification signal of property - persistentStoragePathᅟ.- presentNotification(notification)¶
- Parameters:
- notification – - QWebEngineNotification
 
 - This signal is emitted whenever there is a newly created user notification. The - notificationargument holds the- QWebEngineNotificationinstance to query data and interact with.- See also - presentNotification- pushServiceEnabledChanged()¶
 - Notification signal of property - isPushServiceEnabledᅟ.- queryPermission(securityOrigin, permissionType)¶
- Parameters:
- securityOrigin – - QUrl
- permissionType – - PermissionType
 
- Return type:
 
 - Returns a - QWebEnginePermissionobject corresponding to a single permission for the provided- securityOriginand- permissionType. The object may be used to query for the current state of the permission, or to change it. It is not required for a permission to already exist; the returned object may also be used to pre-grant a permission if a website is known to use it.- Note - This may only be used for persistent permission types. Calling it with a non-persistent - permissionTypewill return an invalid object.- See also - listAllPermissions()- listPermissionsForOrigin()- listPermissionsForPermissionType()- PermissionType- removeAllUrlSchemeHandlers()¶
 - Removes all custom URL scheme handlers installed in the profile. - removeUrlScheme(scheme)¶
- Parameters:
- scheme – - QByteArray
 
 - Removes the custom URL scheme - schemefrom the profile.- See also - removeUrlSchemeHandler(handler)¶
- Parameters:
- handler – - QWebEngineUrlSchemeHandler
 
 - Removes the custom URL scheme handler - handlerfrom the profile.- See also - setCachePath(path)¶
- Parameters:
- path – str 
 - See also 
 - Setter of property - cachePathᅟ.- setDownloadPath(path)¶
- Parameters:
- path – str 
 - See also 
 - Setter of property - downloadPathᅟ.- setHttpAcceptLanguage(httpAcceptLanguage)¶
- Parameters:
- httpAcceptLanguage – str 
 - See also 
 - Setter of property - httpAcceptLanguageᅟ.- setHttpCacheMaximumSize(maxSize)¶
- Parameters:
- maxSize – int 
 - See also 
 - Setter of property - httpCacheMaximumSizeᅟ.- setHttpCacheType(arg__1)¶
- Parameters:
- arg__1 – - HttpCacheType
 - See also 
 - Setter of property - httpCacheTypeᅟ.- setHttpUserAgent(userAgent)¶
- Parameters:
- userAgent – str 
 - See also 
 - Setter of property - httpUserAgentᅟ.- setOffTheRecord(offTheRecord)¶
- Parameters:
- offTheRecord – bool 
 - See also 
 - Setter of property - offTheRecordᅟ.- setPersistentCookiesPolicy(arg__1)¶
- Parameters:
- arg__1 – - PersistentCookiesPolicy
 - See also 
 - Setter of property - persistentCookiesPolicyᅟ.- setPersistentPermissionsPolicy(arg__1)¶
- Parameters:
- arg__1 – - PersistentPermissionsPolicy
 - See also 
 - Setter of property - persistentPermissionsPolicyᅟ.- setPersistentStoragePath(path)¶
- Parameters:
- path – str 
 - See also 
 - Setter of property - persistentStoragePathᅟ.- setPushServiceEnabled(enable)¶
- Parameters:
- enable – bool 
 - See also 
 - Setter of property - isPushServiceEnabledᅟ.- setSpellCheckEnabled(enabled)¶
- Parameters:
- enabled – bool 
 - See also 
 - Setter of property - spellCheckEnabledᅟ.- setSpellCheckLanguages(languages)¶
- Parameters:
- languages – list of strings 
 - See also 
 - Setter of property - spellCheckLanguagesᅟ.- setStorageName(name)¶
- Parameters:
- name – str 
 - See also 
 - Setter of property - storageNameᅟ.- setUrlRequestInterceptor(interceptor)¶
- Parameters:
- interceptor – - QWebEngineUrlRequestInterceptor
 
 - Registers a request interceptor singleton - interceptorto intercept URL requests.- The profile does not take ownership of the pointer. - spellCheckEnabledChanged()¶
 - Notification signal of property - spellCheckEnabledᅟ.- spellCheckLanguages()¶
- Return type:
- list of strings 
 
 - Returns the list of languages used by the spell checker. - See also - Getter of property - spellCheckLanguagesᅟ.- spellCheckLanguagesChanged()¶
 - Notification signal of property - spellCheckLanguagesᅟ.- storageName()¶
- Return type:
- str 
 - See also 
 - Getter of property - storageNameᅟ.- storageNameChanged()¶
 - Notification signal of property - storageNameᅟ.- urlSchemeHandler(scheme)¶
- Parameters:
- scheme – - QByteArray
- Return type:
 
 - Returns the custom URL scheme handler register for the URL scheme - scheme.