QWebEngineSettings 类提供对象以存储设置,用于 QWebEnginePage . 更多...
头: | #include <QWebEngineSettings> |
qmake: | QT += webenginewidgets |
Since: | Qt 5.4 |
enum | FontFamily { StandardFont, FixedFont, SerifFont, SansSerifFont, ..., PictographFont } |
enum | FontSize { MinimumFontSize, MinimumLogicalFontSize, DefaultFontSize, DefaultFixedFontSize } |
enum | WebAttribute { AutoLoadImages, JavascriptEnabled, JavascriptCanOpenWindows, JavascriptCanAccessClipboard, ..., AllowGeolocationOnInsecureOrigins } |
QString | defaultTextEncoding () const |
QString | fontFamily (FontFamily which ) const |
int | fontSize (FontSize type ) const |
void | resetAttribute (WebAttribute attribute ) |
void | resetFontFamily (FontFamily which ) |
void | resetFontSize (FontSize type ) |
void | setAttribute (WebAttribute attribute , bool on ) |
void | setDefaultTextEncoding (const QString & encoding ) |
void | setFontFamily (FontFamily which , const QString & family ) |
void | setFontSize (FontSize type , int size ) |
bool | testAttribute (WebAttribute attribute ) const |
QWebEngineSettings * | defaultSettings () |
QWebEngineSettings 类提供对象以存储设置,用于 QWebEnginePage .
QWebEngineSettings allows configuration of browser properties, such as font sizes and families, the location of a custom style sheet, and generic attributes, such as JavaScript support. Individual attributes are set using the setAttribute () 函数。 WebAttribute 枚举进一步描述各属性。
每个 QWebEnginePage object has its own QWebEngineSettings object, which configures the settings for that page. If a setting is not configured for a web engine page, it is looked up in the settings of the profile the page belongs to.
另请参阅 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
|
用于固定间距文本的默认字体大小。 |
此枚举类型指定网页设置:
常量 | 值 | 描述 |
---|---|---|
QWebEngineSettings::AutoLoadImages
|
0
|
自动下载网页图像。当禁用此设置时,将从缓存加载图像。默认启用。 |
QWebEngineSettings::JavascriptEnabled
|
1
|
Enables the running of JavaScript programs. Enabled by default. |
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. 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
|
Monitors load requests for cross-site scripting attempts. Suspicious scripts are blocked and reported in the inspector's JavaScript console. Disabled by default, because it might negatively affect performance. |
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). Enabled 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) |
[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.
启用或禁用指定 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 ().
返回
true
if
attribute
被启用;否则返回
false
.