QWebEngineSettings Class
The QWebEngineSettings class provides an object to store the settings used by QWebEnginePage More...
Header: | #include <QWebEngineSettings> |
Since: | QtWebEngine 1.0 |
Public Types
enum | FontFamily { StandardFont, FixedFont, SerifFont, SansSerifFont, CursiveFont, FantasyFont } |
enum | FontSize { MinimumFontSize, MinimumLogicalFontSize, DefaultFontSize, DefaultFixedFontSize } |
enum | WebAttribute { AutoLoadImages, JavascriptEnabled, JavascriptCanOpenWindows, JavascriptCanAccessClipboard, ..., ErrorPageEnabled } |
Public Functions
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 |
Static Public Members
QWebEngineSettings * | globalSettings() |
Detailed Description
The QWebEngineSettings class provides an object to store the settings used by QWebEnginePage
Each QWebEnginePage object has its own QWebEngineSettings object, which configures the settings for that page. If a setting is not configured, then it is looked up in the global settings object, which can be accessed using globalSettings().
QWebEngineSettings allows configuration of browser properties, such as font sizes and families, the location of a custom style sheet, and generic attributes like JavaScript and plugins. Individual attributes are set using the setAttribute() function. The WebAttribute enum further describes each attribute.
See also QWebEnginePage::settings() and QWebEngineView::settings().
Member Type Documentation
enum QWebEngineSettings::FontFamily
This enum describes the generic font families defined by CSS 2. For more information see the CSS standard.
Constant | Value |
---|---|
QWebEngineSettings::StandardFont | 0 |
QWebEngineSettings::FixedFont | 1 |
QWebEngineSettings::SerifFont | 2 |
QWebEngineSettings::SansSerifFont | 3 |
QWebEngineSettings::CursiveFont | 4 |
QWebEngineSettings::FantasyFont | 5 |
enum QWebEngineSettings::FontSize
This enum describes the font sizes configurable through QWebEngineSettings.
Constant | Value | Description |
---|---|---|
QWebEngineSettings::MinimumFontSize | 0 | The hard minimum font size. |
QWebEngineSettings::MinimumLogicalFontSize | 1 | The minimum logical font size that is applied when zooming out with QWebEngineFrame::setTextSizeMultiplier(). |
QWebEngineSettings::DefaultFontSize | 2 | The default font size for regular text. |
QWebEngineSettings::DefaultFixedFontSize | 3 | The default font size for fixed-pitch text. |
enum QWebEngineSettings::WebAttribute
This enum describes various attributes that are configurable through QWebEngineSettings.
Constant | Value | Description |
---|---|---|
QWebEngineSettings::AutoLoadImages | 0 | Specifies whether images are automatically loaded in web pages. This is enabled by default. |
QWebEngineSettings::JavascriptEnabled | 1 | Enables or disables the running of JavaScript programs. This is enabled by default |
QWebEngineSettings::JavascriptCanOpenWindows | 2 | Specifies whether JavaScript programs can open new windows. This is enabled by default. |
QWebEngineSettings::JavascriptCanAccessClipboard | 3 | Specifies whether JavaScript programs can read or write to the clipboard. This is disabled by default. |
QWebEngineSettings::LinksIncludedInFocusChain | 4 | Specifies whether hyperlinks should be included in the keyboard focus chain. This is enabled by default. |
QWebEngineSettings::LocalStorageEnabled | 5 | Specifies whether support for the HTML 5 local storage feature is enabled or not. This is enabled by default. |
QWebEngineSettings::LocalContentCanAccessRemoteUrls | 6 | Specifies whether locally loaded documents are allowed to access remote urls. This is disabled by default. For more information about security origins and local vs. remote content see QWebEngineSecurityOrigin. |
QWebEngineSettings::XSSAuditingEnabled | 7 | Specifies whether load requests should be monitored for cross-site scripting attempts. Suspicious scripts will be blocked and reported in the inspector's JavaScript console. Enabling this feature might have an impact on performance and it is disabled by default. |
QWebEngineSettings::SpatialNavigationEnabled | 8 | Enables or disables the Spatial Navigation feature, which consists in the ability to navigate between focusable elements in a Web page, such as hyperlinks and form controls, by using Left, Right, Up and Down arrow keys. For example, if a user presses the Right key, heuristics determine whether there is an element he might be trying to reach towards the right and which element he probably wants. This is disabled by default. |
QWebEngineSettings::LocalContentCanAccessFileUrls | 9 | Specifies whether locally loaded documents are allowed to access other local urls. This is enabled by default. For more information about security origins and local vs. remote content see QWebEngineSecurityOrigin. |
QWebEngineSettings::HyperlinkAuditingEnabled | 10 | This setting enables support for the ping attribute for hyperlinks. It is disabled by default. |
QWebEngineSettings::ScrollAnimatorEnabled | 11 | This setting enables animated scrolling. It is disabled by default. |
QWebEngineSettings::ErrorPageEnabled | 12 | This setting enables built-in error pages of Chromium. It is enabled by default. |
Member Function Documentation
QString QWebEngineSettings::defaultTextEncoding() const
Returns the default text encoding.
See also setDefaultTextEncoding().
QString QWebEngineSettings::fontFamily(FontFamily which) const
Returns the actual font family for the specified generic font family, which.
See also setFontFamily().
int QWebEngineSettings::fontSize(FontSize type) const
Returns the default font size for type.
See also setFontSize().
[static]
QWebEngineSettings * QWebEngineSettings::globalSettings()
Returns the global settings object.
Any setting changed on the default object is automatically applied to all QWebEnginePage instances where the particular setting is not overridden already.
void QWebEngineSettings::resetAttribute(WebAttribute attribute)
Resets the setting of attribute to the value specified in the global QWebEngineSettings instance.
This function has no effect on the global QWebEngineSettings instance.
See also globalSettings().
void QWebEngineSettings::resetFontFamily(FontFamily which)
Resets the actual font family specified by which to the one set in the global QWebEngineSettings instance.
This function has no effect on the global QWebEngineSettings instance.
void QWebEngineSettings::resetFontSize(FontSize type)
Resets the font size for type to the size specified in the global settings object.
This function has no effect on the global QWebEngineSettings instance.
void QWebEngineSettings::setAttribute(WebAttribute attribute, bool on)
Enables or disables the specified attribute feature depending on the value of on.
void QWebEngineSettings::setDefaultTextEncoding(const QString & encoding)
Specifies the default text encoding system.
The encoding, must be a string describing an encoding such as "utf-8", "iso-8859-1", etc. If left empty a default value will be used. For a more extensive list of encoding names see QTextCodec
See also defaultTextEncoding().
void QWebEngineSettings::setFontFamily(FontFamily which, const QString & family)
Sets the actual font family to family for the specified generic family, which.
See also fontFamily().
void QWebEngineSettings::setFontSize(FontSize type, int size)
Sets the font size for type to size.
See also fontSize().
bool QWebEngineSettings::testAttribute(WebAttribute attribute) const
Returns true if attribute is enabled; otherwise returns false.
© 2015 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.