QWebEngineSettings 类提供对象以存储设置,用于 QWebEnginePage . 更多...
头: | #include <QWebEngineSettings> |
qmake: | QT += webenginewidgets |
Since: | Qt 5.4 |
该类在 Qt 5.4 引入。
enum | FontFamily { StandardFont, FixedFont, SerifFont, SansSerifFont, CursiveFont, …, PictographFont } |
enum | FontSize { MinimumFontSize, MinimumLogicalFontSize, DefaultFontSize, DefaultFixedFontSize } |
enum | UnknownUrlSchemePolicy { DisallowUnknownUrlSchemes, AllowUnknownUrlSchemesFromUserInteraction, AllowAllUnknownUrlSchemes } |
enum | WebAttribute { AutoLoadImages, JavascriptEnabled, JavascriptCanOpenWindows, JavascriptCanAccessClipboard, LinksIncludedInFocusChain, …, PdfViewerEnabled } |
QString | defaultTextEncoding () const |
QString | fontFamily (QWebEngineSettings::FontFamily which ) const |
int | fontSize (QWebEngineSettings::FontSize type ) const |
void | resetAttribute (QWebEngineSettings::WebAttribute attribute ) |
void | resetFontFamily (QWebEngineSettings::FontFamily which ) |
void | resetFontSize (QWebEngineSettings::FontSize type ) |
void | resetUnknownUrlSchemePolicy () |
void | setAttribute (QWebEngineSettings::WebAttribute attribute , bool on ) |
void | setDefaultTextEncoding (const QString & encoding ) |
void | setFontFamily (QWebEngineSettings::FontFamily which , const QString & family ) |
void | setFontSize (QWebEngineSettings::FontSize type , int size ) |
void | setUnknownUrlSchemePolicy (QWebEngineSettings::UnknownUrlSchemePolicy policy ) |
bool | testAttribute (QWebEngineSettings::WebAttribute attribute ) const |
QWebEngineSettings::UnknownUrlSchemePolicy | unknownUrlSchemePolicy () const |
QWebEngineSettings * | defaultSettings () |
QWebEngineSettings 允许配置浏览器特性,譬如字体大小和系列、自定义样式表的位置及一般属性 (譬如 JavaScript 支持)。单个属性的设置使用 setAttribute () 函数。 WebAttribute 枚举进一步描述各属性。
每个 QWebEnginePage 对象有自己的 qwebengineessettings 对象 (为该页面配置设置)。若尚未为 web 引擎页面配置设置,它将在页面所属的 profile (配置文件) 设置中查找。
另请参阅 QWebEnginePage::settings () 和 QWebEngineView::settings ().
此枚举描述由 CSS 2 定义的一般字体系列。更多信息见 CSS 标准 .
常量 | 值 | 描述 |
---|---|---|
QWebEngineSettings::StandardFont
|
0
|
|
QWebEngineSettings::FixedFont
|
1
|
|
QWebEngineSettings::SerifFont
|
2
|
|
QWebEngineSettings::SansSerifFont
|
3
|
|
QWebEngineSettings::CursiveFont
|
4
|
|
QWebEngineSettings::FantasyFont
|
5
|
|
QWebEngineSettings::PictographFont
|
6
|
(在 Qt 5.7 添加) |
此枚举描述字体大小, 可配置透过 QWebEngineSettings :
常量 | 值 | 描述 |
---|---|---|
QWebEngineSettings::MinimumFontSize
|
0
|
硬最小字体大小。 |
QWebEngineSettings::MinimumLogicalFontSize
|
1
|
当缩小时应用的最小逻辑字体大小。 |
QWebEngineSettings::DefaultFontSize
|
2
|
用于常规文本的默认字体大小。 |
QWebEngineSettings::DefaultFixedFontSize
|
3
|
用于固定间距文本的默认字体大小。 |
此枚举描述如何处理具有未知方案的 URL 导航请求。
常量 | 值 | 描述 |
---|---|---|
QWebEngineSettings::DisallowUnknownUrlSchemes
|
1
|
禁止所有具有未知方案的 URL 导航请求。 |
QWebEngineSettings::AllowUnknownUrlSchemesFromUserInteraction
|
2
|
Allows navigation requests to URLs with unknown schemes that are issued from user-interaction (like a mouse-click), whereas other navigation requests (for example from JavaScript) are suppressed. |
QWebEngineSettings::AllowAllUnknownUrlSchemes
|
3
|
Allows all navigation requests to URLs with unknown schemes. |
该枚举在 Qt 5.11 引入或被修改。
另请参阅 unknownUrlSchemePolicy , setUnknownUrlSchemePolicy ,和 resetUnknownUrlSchemePolicy .
此枚举类型指定网页设置:
常量 | 值 | 描述 |
---|---|---|
QWebEngineSettings::AutoLoadImages
|
0
|
自动下载网页图像。当禁用此设置时,将从缓存加载图像。默认启用。 |
QWebEngineSettings::JavascriptEnabled
|
1
|
使 JavaScript 程序能够运行在 MainWorld 。默认启用。 |
QWebEngineSettings::JavascriptCanOpenWindows
|
2
|
允许 JavaScript 程序打开弹出窗口 (无需用户交互)。默认启用。 |
QWebEngineSettings::JavascriptCanAccessClipboard
|
3
|
Allows JavaScript programs to read from and write to the clipboard. Writing to the clipboard is always allowed if it is specifically requested by the user. See JavascriptCanPaste to also allow pasting the content of the clipboard content from JavaScript. Disabled by default. |
QWebEngineSettings::LinksIncludedInFocusChain
|
4
|
Includes hyperlinks in the keyboard focus chain. Enabled by default. |
QWebEngineSettings::LocalStorageEnabled
|
5
|
Enables support for the HTML 5 local storage feature. Enabled by default. |
QWebEngineSettings::LocalContentCanAccessRemoteUrls
|
6
|
Allows locally loaded documents to ignore cross-origin rules so that they can access remote resources that would normally be blocked, because all remote resources are considered cross-origin for a local file. Remote access that would not be blocked by cross-origin rules is still possible when this setting is disabled (default). Note that disabling this setting does not stop XMLHttpRequests or media elements in local files from accessing remote content. Basically, it only stops some HTML subresources, such as scripts, and therefore disabling this setting is not a safety mechanism. |
QWebEngineSettings::XSSAuditingEnabled
|
7
|
过时且不起作用。 |
QWebEngineSettings::SpatialNavigationEnabled
|
8
|
Enables the Spatial Navigation feature, which means the ability to navigate between focusable elements, such as hyperlinks and form controls, on a web page by using the Left, Right, Up and Down arrow keys. For example, if a user presses the Right key, heuristics determine whether there is an element they might be trying to reach towards the right and which element they probably want. Disabled by default. |
QWebEngineSettings::LocalContentCanAccessFileUrls
|
9
|
Allows locally loaded documents to access other local URLs. Enabled by default. |
QWebEngineSettings::HyperlinkAuditingEnabled
|
10
|
启用支持
ping
属性为超链接。默认禁用。
|
QWebEngineSettings::ScrollAnimatorEnabled
|
11
|
启用动画卷动。默认禁用。 |
QWebEngineSettings::ErrorPageEnabled
|
12
|
Enables displaying the built-in error pages of Chromium. Enabled by default. |
QWebEngineSettings::PluginsEnabled
|
13
|
Enables support for Pepper plugins, such as the Flash player. Disabled by default. See also Pepper 插件 API 。(在 Qt 5.6 添加) |
QWebEngineSettings::FullScreenSupportEnabled
|
14
|
Enables fullscreen support in an application. Disabled by default. (Added in Qt 5.6) |
QWebEngineSettings::ScreenCaptureEnabled
|
15
|
Enables screen capture in an application. Disabled by default. (Added in Qt 5.7) |
QWebEngineSettings::WebGLEnabled
|
16
|
启用支持 HTML 5 WebGL。默认启用若可用。(在 Qt 5.7 添加) |
QWebEngineSettings::Accelerated2dCanvasEnabled
|
17
|
Specifies whether the HTML5 2D canvas should be a OpenGL framebuffer. This makes many painting operations faster, but slows down pixel access. Enabled by default if available. (Added in Qt 5.7) |
QWebEngineSettings::AutoLoadIconsForPage
|
18
|
自动下载网页图标。默认启用。(在 Qt 5.7 添加) |
QWebEngineSettings::TouchIconsEnabled
|
19
|
Enables support for touch icons and precomposed touch icons Disabled by default. (Added in Qt 5.7) |
QWebEngineSettings::FocusOnNavigationEnabled
|
20
|
Gives focus to the view associated with the page, whenever a navigation operation occurs (load, stop, reload, reload and bypass cache, forward, backward, set content, and so on). Disabled by default. (Added in Qt 5.8) |
QWebEngineSettings::PrintElementBackgrounds
|
21
|
Turns on printing of CSS backgrounds when printing a web page. Enabled by default. (Added in Qt 5.8) |
QWebEngineSettings::AllowRunningInsecureContent
|
22
|
By default, HTTPS pages cannot run JavaScript, CSS, plugins or web-sockets from HTTP URLs. This provides an override to get the old insecure behavior. Disabled by default. (Added in Qt 5.8) |
QWebEngineSettings::AllowGeolocationOnInsecureOrigins
|
23
|
Since Qt 5.7, only secure origins such as HTTPS have been able to request Geolocation features. This provides an override to allow non secure origins to access Geolocation again. Disabled by default. (Added in Qt 5.9) |
QWebEngineSettings::AllowWindowActivationFromJavaScript
|
24
|
允许通过使用 window.focus() JavaScript 方法激活窗口。默认禁用。(在 Qt 5.10 添加) |
QWebEngineSettings::ShowScrollBars
|
25
|
展示滚动条。默认启用。(在 Qt 5.10 添加) |
QWebEngineSettings::PlaybackRequiresUserGesture
|
26
|
Inhibits playback of media content until the user interacts with the page. By default, WebEngine uses Chromium settings, as described in Autoplay Policy Changes . This is similar to how Chrome on Android behaves, while the default behavior when it is disabled is similar to Chrome on desktops. To overwrite the default behavior, disable this setting. (Added in Qt 5.11) |
QWebEngineSettings::JavascriptCanPaste
|
28
|
启用 JavaScript
execCommand("paste")
. This also requires enabling JavascriptCanAccessClipboard. Disabled by default. (Added in Qt 5.11)
|
QWebEngineSettings::WebRTCPublicInterfacesOnly
|
27
|
限制 WebRTC 到仅公共 IP 地址。当禁用 WebRTC 还可能使用本地网络 IP 地址,但远程主机还可以看到本地网络 IP 地址。默认禁用。(在 Qt 5.11 添加) |
QWebEngineSettings::DnsPrefetchEnabled
|
29
|
指定是否 WebEngine 将试着预抓取 DNS 条目以加速浏览。默认禁用。(在 Qt 5.12 添加) |
QWebEngineSettings::PdfViewerEnabled
|
30
|
指定 PDF 文档将在内部 PDF 查看器中打开而不是下载。默认启用。(在 Qt 5.13 添加) |
[static]
QWebEngineSettings
*QWebEngineSettings::
defaultSettings
()
Returns the settings for a web engine page that belongs to the default profile. All web pages not specifically created with another profile belong to the default profile.
返回默认文本编码。
另请参阅 setDefaultTextEncoding ().
Returns the actual font family for the specified generic font family, which .
另请参阅 setFontFamily ().
返回默认字体大小对于 type (以像素为单位)。
另请参阅 setFontSize ().
Resets the setting of attribute to the value specified in the profile that the page belongs to.
Resets the actual font family specified by which to the one specified in the profile that the page belongs to.
Resets the font size for type to the size specified in the profile that the page belongs to.
Removes the policy for handling navigation requests to URLs with unknown schemes.
该函数在 Qt 5.11 引入。
另请参阅 unknownUrlSchemePolicy and setUnknownUrlSchemePolicy .
启用或禁用指定 attribute 特征从属值 on .
指定默认文本编码系统。
值 encoding must be a string describing an encoding such as "utf-8" or "iso-8859-1". If left empty, a default value will be used. For a more extensive list of encoding names see QTextCodec .
另请参阅 defaultTextEncoding ().
将实际字体系列设为 family 为指定一般系列, which .
另请参阅 fontFamily ().
设置字体大小对于 type to size (以像素为单位)。
另请参阅 fontSize ().
Sets the policy for handling navigation requests to URLs with unknown schemes to policy . Default is QWebEngineSettings::AllowUnknownUrlSchemesFromUserInteraction .
该函数在 Qt 5.11 引入。
另请参阅 unknownUrlSchemePolicy and resetUnknownUrlSchemePolicy .
返回
true
if
attribute
被启用;否则返回
false
.
Returns the currently selected policy for handling navigation requests to URLs with unknown schemes. Default is QWebEngineSettings::AllowUnknownUrlSchemesFromUserInteraction .
该函数在 Qt 5.11 引入。
另请参阅 setUnknownUrlSchemePolicy and resetUnknownUrlSchemePolicy .