QWebEngineSettingsclass provides an object to store the settings used byQWebEnginePage. 更多 …
def
defaultTextEncoding
()
def
fontFamily
(which)
def
fontSize
(type)
def
resetAttribute
(attr)
def
resetFontFamily
(which)
def
resetFontSize
(type)
def
resetUnknownUrlSchemePolicy
()
def
setAttribute
(attr, on)
def
setDefaultTextEncoding
(encoding)
def
setFontFamily
(which, family)
def
setFontSize
(type, size)
def
setUnknownUrlSchemePolicy
(policy)
def
testAttribute
(attr)
def
unknownUrlSchemePolicy
()
def
defaultSettings
()
def
globalSettings
()
QWebEngineSettingsallows 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 thesetAttribute()function. TheWebAttributeenum further describes each attribute.每
QWebEnginePageobject has its ownQWebEngineSettingsobject, 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.另请参阅
PySide2.QtWebEngineWidgets.QWebEngineSettings.
FontFamily
¶
This enum describes the generic font families defined by CSS 2. For more information see the CSS standard .
|
常量 |
描述 |
|---|---|
|
QWebEngineSettings.StandardFont |
|
|
QWebEngineSettings.FixedFont |
|
|
QWebEngineSettings.SerifFont |
|
|
QWebEngineSettings.SansSerifFont |
|
|
QWebEngineSettings.CursiveFont |
|
|
QWebEngineSettings.FantasyFont |
|
|
QWebEngineSettings.PictographFont |
(added in Qt 5.7) |
PySide2.QtWebEngineWidgets.QWebEngineSettings.
WebAttribute
¶
此枚举类型指定网页设置:
|
常量 |
描述 |
|---|---|
|
QWebEngineSettings.AutoLoadImages |
Automatically dowloads images for web pages. When this setting is disabled, images are loaded from the cache. Enabled by default. |
|
QWebEngineSettings.JavascriptEnabled |
Enables the running of JavaScript programs in the
|
|
QWebEngineSettings.JavascriptCanOpenWindows |
允许 JavaScript 程序打开弹出窗口 (无需用户交互)。默认启用。 |
|
QWebEngineSettings.JavascriptCanAccessClipboard |
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 to also allow pasting the content of the clipboard content from JavaScript. Disabled by default. |
|
QWebEngineSettings.LinksIncludedInFocusChain |
Includes hyperlinks in the keyboard focus chain. Enabled by default. |
|
QWebEngineSettings.LocalStorageEnabled |
Enables support for the HTML 5 local storage feature. Enabled by default. |
|
QWebEngineSettings.LocalContentCanAccessRemoteUrls |
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 |
Obsolete and has no effect. |
|
QWebEngineSettings.SpatialNavigationEnabled |
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 |
Allows locally loaded documents to access other local URLs. Enabled by default. |
|
QWebEngineSettings.HyperlinkAuditingEnabled |
Enables support for the
|
|
QWebEngineSettings.ScrollAnimatorEnabled |
Enables animated scrolling. Disabled by default. |
|
QWebEngineSettings.ErrorPageEnabled |
Enables displaying the built-in error pages of Chromium. Enabled by default. |
|
QWebEngineSettings.PluginsEnabled |
Enables support for Pepper plugins, such as the Flash player. Disabled by default. See also Pepper 插件 API 。(在 Qt 5.6 添加) |
|
QWebEngineSettings.FullScreenSupportEnabled |
Enables fullscreen support in an application. Disabled by default. (Added in Qt 5.6) |
|
QWebEngineSettings.ScreenCaptureEnabled |
Enables screen capture in an application. Disabled by default. (Added in Qt 5.7) |
|
QWebEngineSettings.WebGLEnabled |
Enables support for HTML 5 WebGL. Enabled by default if available. (Added in Qt 5.7) |
|
QWebEngineSettings.Accelerated2dCanvasEnabled |
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 |
Automatically downloads icons for web pages. Enabled by default. (Added in Qt 5.7) |
|
QWebEngineSettings.TouchIconsEnabled |
Enables support for touch icons and precomposed touch icons Disabled by default. (Added in Qt 5.7) |
|
QWebEngineSettings.FocusOnNavigationEnabled |
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 |
Turns on printing of CSS backgrounds when printing a web page. Enabled by default. (Added in Qt 5.8) |
|
QWebEngineSettings.AllowRunningInsecureContent |
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 |
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 |
Allows activating windows by using the window.focus() JavaScript method. Disabled by default. (Added in Qt 5.10) |
|
QWebEngineSettings.ShowScrollBars |
Shows scroll bars. Enabled by default. (Added in Qt 5.10) |
|
QWebEngineSettings.PlaybackRequiresUserGesture |
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 |
Enables JavaScript
|
|
QWebEngineSettings.WebRTCPublicInterfacesOnly |
Limits WebRTC to public IP addresses only. When disabled WebRTC may also use local network IP addresses, but remote hosts can also see your local network IP address. Disabled by default. (Added in Qt 5.11) |
|
QWebEngineSettings.DnsPrefetchEnabled |
指定是否 WebEngine will try to pre-fetch DNS entries to speed up browsing. Disabled by default. (Added in Qt 5.12) |
|
QWebEngineSettings.PdfViewerEnabled |
Specifies that PDF documents will be opened in the internal PDF viewer instead of being downloaded. Enabled by default. (Added in Qt 5.13) |
PySide2.QtWebEngineWidgets.QWebEngineSettings.
FontSize
¶
This enum describes the font sizes configurable through
QWebEngineSettings
:
|
常量 |
描述 |
|---|---|
|
QWebEngineSettings.MinimumFontSize |
The hard minimum font size. |
|
QWebEngineSettings.MinimumLogicalFontSize |
The minimum logical font size that is applied when zooming out. |
|
QWebEngineSettings.DefaultFontSize |
The default font size for regular text. |
|
QWebEngineSettings.DefaultFixedFontSize |
The default font size for fixed-pitch text. |
PySide2.QtWebEngineWidgets.QWebEngineSettings.
UnknownUrlSchemePolicy
¶
This enum describes how navigation requests to URLs with unknown schemes are handled.
|
常量 |
描述 |
|---|---|
|
QWebEngineSettings.DisallowUnknownUrlSchemes |
Disallows all navigation requests to URLs with unknown schemes. |
|
QWebEngineSettings.AllowUnknownUrlSchemesFromUserInteraction |
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 |
Allows all navigation requests to URLs with unknown schemes. |
New in version 5.11.
PySide2.QtWebEngineWidgets.QWebEngineSettings.
defaultSettings
(
)
¶
QWebEngineSettings
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.
PySide2.QtWebEngineWidgets.QWebEngineSettings.
defaultTextEncoding
(
)
¶
unicode
Returns the default text encoding.
PySide2.QtWebEngineWidgets.QWebEngineSettings.
fontFamily
(
which
)
¶
which
–
FontFamily
unicode
Returns the actual font family for the specified generic font family,
which
.
另请参阅
PySide2.QtWebEngineWidgets.QWebEngineSettings.
fontSize
(
type
)
¶
type
–
FontSize
int
Returns the default font size for
type
in pixels.
另请参阅
PySide2.QtWebEngineWidgets.QWebEngineSettings.
globalSettings
(
)
¶
QWebEngineSettings
使用
defaultSettings()
代替。
PySide2.QtWebEngineWidgets.QWebEngineSettings.
resetAttribute
(
attr
)
¶
attr
–
WebAttribute
Resets the setting of
attribute
to the value specified in the profile that the page belongs to.
PySide2.QtWebEngineWidgets.QWebEngineSettings.
resetFontFamily
(
which
)
¶
which
–
FontFamily
Resets the actual font family specified by
which
to the one specified in the profile that the page belongs to.
PySide2.QtWebEngineWidgets.QWebEngineSettings.
resetFontSize
(
type
)
¶
type
–
FontSize
Resets the font size for
type
to the size specified in the profile that the page belongs to.
PySide2.QtWebEngineWidgets.QWebEngineSettings.
resetUnknownUrlSchemePolicy
(
)
¶
Removes the policy for handling navigation requests to URLs with unknown schemes.
PySide2.QtWebEngineWidgets.QWebEngineSettings.
setAttribute
(
attr
,
on
)
¶
attr
–
WebAttribute
on
–
bool
Enables or disables the specified
attribute
feature depending on the value of
on
.
PySide2.QtWebEngineWidgets.QWebEngineSettings.
setDefaultTextEncoding
(
encoding
)
¶
encoding – unicode
Specifies the default text encoding system.
值
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
.
PySide2.QtWebEngineWidgets.QWebEngineSettings.
setFontFamily
(
which
,
family
)
¶
which
–
FontFamily
family – unicode
Sets the actual font family to
family
for the specified generic family,
which
.
另请参阅
PySide2.QtWebEngineWidgets.QWebEngineSettings.
setFontSize
(
type
,
size
)
¶
type
–
FontSize
size
–
int
Sets the font size for
type
to
size
in pixels.
另请参阅
PySide2.QtWebEngineWidgets.QWebEngineSettings.
setUnknownUrlSchemePolicy
(
policy
)
¶
policy
–
UnknownUrlSchemePolicy
Sets the policy for handling navigation requests to URLs with unknown schemes to
policy
. Default is
AllowUnknownUrlSchemesFromUserInteraction
.
PySide2.QtWebEngineWidgets.QWebEngineSettings.
testAttribute
(
attr
)
¶
attr
–
WebAttribute
bool
返回
true
if
attribute
被启用;否则返回
false
.
PySide2.QtWebEngineWidgets.QWebEngineSettings.
unknownUrlSchemePolicy
(
)
¶
Returns the currently selected policy for handling navigation requests to URLs with unknown schemes. Default is
AllowUnknownUrlSchemesFromUserInteraction
.