Contains settings, scripts, and visited links common to multiple web engine views. 更多...
import 语句: | import QtWebEngine |
Since: | QtWebEngine 1.1 |
实例化: | QQuickWebEngineProfile |
WebEngineProfile contains settings, scripts, and the list of visited links shared by all views 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 对于 隐私浏览 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.
Each web engine view has an associated profile. Views that do not have a specific profile set share a common default one.
cachePath : string |
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 .
[since QtWebEngine 1.9] downloadPath : string |
下载文件存储位置的路径。
Overrides the default path used for download location.
If set to an empty string, the default path is restored.
注意: 默认情况下,下载路径为 QStandardPaths::DownloadLocation .
This property was introduced in QtWebEngine 1.9.
[since QtWebEngine 1.2] httpAcceptLanguage : string |
The value of the Accept-Language HTTP request-header field.
This property was introduced in QtWebEngine 1.2.
httpCacheMaximumSize : int |
The maximum size of the HTTP cache. If
0
, the size will be controlled automatically by
QtWebEngine
。默认值为
0
.
另请参阅 httpCacheType .
httpCacheType : enumeration |
This enumeration describes the type of the HTTP cache:
常量 | 描述 |
---|---|
WebEngineProfile.MemoryHttpCache
|
Uses an in-memory cache. This is the only setting possible if offTheRecord is set or no storageName is available, which is the default. |
WebEngineProfile.DiskHttpCache
|
Uses a disk cache. This is the default value for non off-the-record profile with storageName . |
WebEngineProfile.NoCache
|
Disables caching. (Added in 5.7) |
httpUserAgent : string |
The user-agent string sent with HTTP to identify the browser.
注意: On Windows 8.1 and newer, the default user agent will always report "Windows NT 6.2" (Windows 8), unless the application does contain a manifest that declares newer Windows versions as supported.
[since QtWebEngine 6.5] isPushServiceEnabled : bool |
Whether the push messaging service is enabled.
注意: By default the push messaging service is disabled.
注意: 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.
This property was introduced in QtWebEngine 6.5.
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.
persistentCookiesPolicy : enumeration |
This enumeration describes the policy of cookie persistency:
常量 | 描述 |
---|---|
WebEngineProfile.NoPersistentCookies
|
Both session and persistent cookies are stored in memory. This is the only setting possible if offTheRecord is set or no storageName is available, which is the default. |
WebEngineProfile.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 value for non off-the-record profile with storageName . |
WebEngineProfile.ForcePersistentCookies
|
会话和持久 Cookie 均保存到磁盘并从中还原。 |
persistentStoragePath : string |
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 .
[since QtWebEngine 1.4] spellCheckEnabled : bool |
This property holds whether the web engine spell checker is enabled.
This property was introduced in QtWebEngine 1.4.
[since QtWebEngine 1.4] spellCheckLanguages : list < string > |
This property holds the list of languages used by the spell checker. Each language should match the name of the
.bdic
字典。例如,语言
en-US
将加载
en-US.bdic
字典文件。
见 拼写检查器特征文档编制 如何搜索字典文件。
了解更多信息关于如何编译
.bdic
字典,见
拼写检查器范例
.
This property was introduced in QtWebEngine 1.4.
storageName : string |
The storage name that is used to create separate subdirectories for each profile that uses the disk for storing persistent data and cache.
另请参阅 WebEngineProfile::persistentStoragePath and WebEngineProfile::cachePath .
[read-only] userScripts : WebEngineScriptCollection |
Returns the collection of WebEngineScript objects that are injected into all pages that share this profile.
downloadFinished ( WebEngineDownloadItem download ) |
This signal is emitted whenever downloading stops, because it finished successfully, was cancelled, or was interrupted (for example, because connectivity was lost). The download argument holds the state of the finished download instance.
注意:
相应处理程序是
onDownloadFinished
.
downloadRequested ( WebEngineDownloadItem download ) |
此信号被发射每当下载已被触发。 download argument holds the state of the download. The download has to be explicitly accepted with WebEngineDownloadItem::accept() or the download will be cancelled by default.
注意:
相应处理程序是
onDownloadRequested
.
|
This signal is emitted whenever there is a newly created user notification. The notification argument holds the WebEngineNotification instance to query data and interact with.
注意:
相应处理程序是
onPresentNotification
.
该信号在 QtWebEngine 1.9 引入。
|
移除 Profile 的缓存条目。
该方法在 QtWebEngine 1.3 引入。
另请参阅 WebEngineProfile::cachePath .