WebSettings
#include <bb/cascades/WebSettings>
Settings for the bb::cascades::WebView control.
Each WebView instance has an associated WebSettings instance, which can be referenced by reading the WebView settings property. You should never have any reason to create an instance of this class yourself. Has to be a QObject derivative in order to be accessible from QML.
BlackBerry 10.0.0
QML properties
| defaultFontSize | : int |
| defaultFontSizeFollowsSystemFontSize | : bool |
| javaScriptEnabled | : bool |
| imageDownloadingEnabled | : bool |
| minimumFontSize | : int |
| userAgent | : QString |
| userStyleSheetLocation | : QUrl |
| webInspectorEnabled | : bool |
| zoomToFitEnabled | : bool |
| activeTextEnabled | : bool |
| viewport | : QVariantMap |
| background | : bb::cascades::Color |
| binaryFontDownloadingEnabled | : bool |
| cookiesEnabled | : bool |
| customHttpHeaders | : QVariantMap |
| devicePixelRatio | : double |
| credentialAutoFillEnabled | : bool |
| formAutoFillEnabled | : bool |
| defaultTextCodecName | : QString |
QML signals
Properties Index
Public Functions Index
Signals Index
| void | defaultFontSizeChanged (int newDefaultFontSize) |
| void | defaultFontSizeFollowsSystemFontSizeChanged (bool newDefaultFontSizeFollowsSystemFontSize) |
| void | javaScriptEnabledChanged (bool enabled) |
| void | imageDownloadingEnabledChanged (bool enabled) |
| void | minimumFontSizeChanged (int newMinimumFontSize) |
| void | userAgentChanged (QString newUserAgent) |
| void | userStyleSheetLocationChanged (QUrl newUserStyleSheetLocation) |
| void | webInspectorEnabledChanged (bool enabled) |
| void | zoomToFitEnabledChanged (bool enabled) |
| bool | activeTextEnabledChanged (bool enabled) |
| void | viewportArgumentsChanged (const QVariantMap &newViewportArguments) |
| void | backgroundChanged (const QVariant &newBackground) |
| void | binaryFontDownloadingEnabledChanged (bool enabled) |
| void | cookiesEnabledChanged (bool enabled) |
| void | customHttpHeadersChanged (const QVariantMap &newCustomHttpHeaders) |
| void | devicePixelRatioChanged (double newDevicePixelRatio) |
| void | credentialAutoFillEnabledChanged (bool enabled) |
| void | formAutoFillEnabledChanged (bool enabled) |
| void | defaultTextCodecNameChanged (const QString &codec) |
Properties
int
Specifies a default font size in CSS pixels to use when none is present in the HTML.
The default is 16.
BlackBerry 10.0.0
bool
Specifies that the default font size should follow the system font size.
Any value set using the defaultFontSize property will be ignored while this setting is true.
The default is false.
BlackBerry 10.0.0
bool
Indicates whether the execution of JavaScript should be enabled in the main frame of the webpage.
The default is true.
BlackBerry 10.0.0
bool
Specifies whether images should be loaded automatically.
The default is true.
BlackBerry 10.0.0
int
Specifies a minimum font size in CSS pixels.
The default is 8.
BlackBerry 10.0.0
QString
Specifies a UserAgent string to be used instead of the device default UserAgent.
The default is the same as the UserAgent employed by the BlackBerry Browser; it depends on the form factor and operating system version present on the device.
BlackBerry 10.0.0
QUrl
Specifies a default override CSS file location.
The default is an empty url which indicates there is no user style sheet.
BlackBerry 10.0.0
bool
Indicates whether the execution of JavaScript should be enabled in the main frame of the webpage.
The default is false. The WebInspector is specifically for debugging and should never be enabled in released software.
BlackBerry 10.0.0
bool
Specifies whether the content should be zoomed out to fit the screen upon loading.
The default is true.
BlackBerry 10.0.0
bool
Specifies whether a post-processor should run over loaded content to highlight any ActiveText segments and connect them to the Invocation Framework.
This processing takes place immediately after any document load completes; it is expensive.
The default is false.
BlackBerry 10.0.0
QVariantMap
This map exposes all of the arguments of the HTML Meta Viewport Tag.
It can be assigned a series of key value pairs from the following sets:
The following case-sensitive strings are accepted as keys: { "intial-scale", "minimum-scale", "maximum-scale", "width", "height", "user-scalable" }
The following case-sensitive strings are accepted for all viewport values though not all of them are necessarily useful for each property: { "auto", "desktop-width", "device-width", "device-height" }
In addition, any non-negative floating point values are also acceptable.
To set a common type of meta viewport tag that requests that the content be laid out to the screen width, and zoomed 1:1, use this:
The default is an empty map which indicates no user specified viewport meta tag should be used.
WebView {
id: webView
url: "http://myserver.mynetwork.net/anycontent.html"
settings.viewport: { "width" : "device-width", "initial-scale" : 1.0 }
}
BlackBerry 10.0.0
QVariant
Set the background color of the web page.
If you wish to enable controls behind the WebView to appear through the web page, you must set a non-opaque color.
The default is opaque white.
BlackBerry 10.0.0
bool
Specifies whether binary "WebFonts" should be loaded automatically.
The default is true.
BlackBerry 10.0.0
bool
Specifies whether network cookies should be enabled.
The default is true.
BlackBerry 10.0.0
QVariantMap
Specifies custom HTTP headers that will be added to every outgoing network request.
Each key value pair in the map will be converted to UTF8 strings and added to outgoing requests as "<key>: <value>".
WebView {
url: "http://myserver.mynetwork.net/anycontent.html"
settings.customHttpHeaders: { "Pragma": "no-cache" }
}
The default is an empty map, i.e. no custom HTTP headers.
BlackBerry 10.0.0
double
devicePixelRatio specify default scaling factor.
devicePixelRatio is the ratio between physical pixels and device-independent pixels (dips) on the device.
Increasing devicePixelRatio will zoom in the content and decreasing it will zoom out the content.
BlackBerry 10.0.0
bool
Specify whether known credentials can be automatically submitted with HTTP requests.
The default is false, setting to true can reduce the amount of times the user is prompted for credentials.
BlackBerry 10.1.0
bool
Specify whether known form fields can be automatically filled out on the users behalf.
The default is false, setting to true can reduce the amount of input the user needs to type.
BlackBerry 10.1.0
QString
Set the default character encoding fallback for when no encoding information is available.
The default is ISO-8859-1.
BlackBerry 10.1.0
Public Functions
Q_SLOT void
Set the default font size for the WebView.
| Parameters | |
|---|---|
| size |
A default font size in CSS pixels. |
BlackBerry 10.0.0
Q_SLOT void
Reset the default font size to its default value of 16.
BlackBerry 10.0.0
bool
Get whether or not the default font size follows the system font size.
BlackBerry 10.0.0
Q_SLOT void
Set whether the default font size follows the system font size.
| Parameters | |
|---|---|
| follows |
Set true to enable this feature, false to disable. |
BlackBerry 10.0.0
Q_SLOT void
Reset default font size follows system font size to its default value of false.
BlackBerry 10.0.0
Q_SLOT void
Set whether JavaScript will be enabled on the WebView.
| Parameters | |
|---|---|
| enabled |
Set true to enable JavaScript, false to disable. |
BlackBerry 10.0.0
Q_SLOT void
Reset JavaScriptEnabled to its default value of true.
BlackBerry 10.0.0
Q_SLOT void
Set whether images will be downloaded by the WebView.
| Parameters | |
|---|---|
| enabled |
Set true to enable image downloading, false to disable. |
BlackBerry 10.0.0
Q_SLOT void
Reset ImageDownloadingEnabled to its default value of true.
BlackBerry 10.0.0
Q_SLOT void
Set the WebView minimum font size.
| Parameters | |
|---|---|
| size |
A minimum font size in CSS pixels. |
BlackBerry 10.0.0
Q_SLOT void
Reset the minimum font size to its default value of 8.
BlackBerry 10.0.0
Q_SLOT void
Set a UserAgent string to use instead of the default UserAgent.
| Parameters | |
|---|---|
| userAgent |
A new user agent string to use with outgoing HTTP requests. |
BlackBerry 10.0.0
QUrl
Get the UserStyleSheetLocation for the WebView.
An empty QUrl indicates no user stylesheet is in use.
BlackBerry 10.0.0
Q_SLOT void
Set a location for a default CSS file.
| Parameters | |
|---|---|
| location |
A url to a file containing default CSS. |
BlackBerry 10.0.0
Q_SLOT void
Reset the user style sheet to its default value of an empty url.
BlackBerry 10.0.0
Q_SLOT void
Sets the WebInspector on or off.
| Parameters | |
|---|---|
| enabled |
Set true to enable the WebInspector, false to disable. |
BlackBerry 10.0.0
Q_SLOT void
Reset the web inspector to being disabled.
BlackBerry 10.0.0
bool
Get whether or not zoom to fit after loading is enabled for the WebView.
BlackBerry 10.0.0
Q_SLOT void
Sets zoom to fit behaviour for the WebView.
| Parameters | |
|---|---|
| enabled |
Set true to enable zoom to fit on load, false to disable. |
BlackBerry 10.0.0
Q_SLOT void
Reset zoom to fit enabled to true.
BlackBerry 10.0.0
bool
Get whether or not active text matching after loading is enabled for the WebView.
BlackBerry 10.0.0
Q_SLOT void
Sets ActiveText parsing enabled.
| Parameters | |
|---|---|
| enabled |
Set true to enable active text matching, false to disable. |
BlackBerry 10.0.0
Q_SLOT void
Resets active text matching to false.
BlackBerry 10.0.0
QVariantMap
Get a map of user viewport arguments for the WebView.
An empty map indicates no user viewport arguments are in use.
BlackBerry 10.0.0
Q_SLOT void
Set a map of meta viewport arguments.
| Parameters | |
|---|---|
| arguments |
A QVariantMap of viewport arguments to be used if none is specified in the html. |
BlackBerry 10.0.0
Q_SLOT void
Resets the user viewport arguments to an empty map.
BlackBerry 10.0.0
QVariant
Get the background of this WebView.
The QVariant returned wraps around a bb::cascades::Paint instance.
BlackBerry 10.0.0
Q_SLOT void
Set a bb::cascades::Paint& background for this WebView.
Presently only ColorPaint is supported. Other Paints will be ignored. A non-opaque color can be used to allow controls behind this WebView to be visible.
The default is opaque white.
| Parameters | |
|---|---|
| paint |
A ColorPaint to be used as a background for this WebView. |
BlackBerry 10.0.0
Q_SLOT void
Resets the background to opaque white.
BlackBerry 10.0.0
Q_SLOT void
Set whether or not WebFonts should be downloaded.
| Parameters | |
|---|---|
| enabled |
Set true to enable downloading of web fonts, false to disable. |
BlackBerry 10.0.0
Q_SLOT void
Resets binary font downloading to true.
BlackBerry 10.0.0
Q_SLOT void
Set whether or not cookies should be enabled.
| Parameters | |
|---|---|
| enabled |
Set true to enable cookies, false to disable. |
BlackBerry 10.0.0
Q_SLOT void
Resets cookies enabled to true.
BlackBerry 10.0.0
QVariantMap
Get a map of custom HTTP headers that will be added to every outgoing network request.
An empty map indicates no custom HTTP headers are in use.
A map where each key value pair corresponds to an HTTP header
BlackBerry 10.0.0
Q_SLOT void
Set a map of custom HTTP headers to be added to every outgoing network request.
| Parameters | |
|---|---|
| httpHeaders |
A QVariantMap where each key value pair corresponds to an HTTP header. |
BlackBerry 10.0.0
Q_SLOT void
Resets the custom HTTP headers to an empty map.
BlackBerry 10.0.0
double
Get device pixel ratio.
BlackBerry 10.0.0
Q_SLOT void
Set device pixel ratio.
| Parameters | |
|---|---|
| ratio |
A pixel ratio. |
BlackBerry 10.0.0
Q_SLOT void
Reset device pixel ratio to default value.
Default value is the ratio between physical pixels and dips on the device.
BlackBerry 10.0.0
bool
Get whether or not credentials are automatically filled if available.
BlackBerry 10.1.0
Q_SLOT void
Set whether or not credentials are automatically filled if available.
| Parameters | |
|---|---|
| enabled |
Set true to enable credential auto fill. |
BlackBerry 10.1.0
Q_SLOT void
Resets credential auto fill to default.
BlackBerry 10.1.0
bool
Get whether or not credentials are automatically filled if available.
BlackBerry 10.1.0
Q_SLOT void
Set whether or not credentials are automatically filled if available.
| Parameters | |
|---|---|
| enabled |
Set true to enable credential auto fill. |
BlackBerry 10.1.0
Q_SLOT void
Resets credential auto fill to default.
BlackBerry 10.1.0
Q_SLOT void
Set a default character encoding.
| Parameters | |
|---|---|
| codec |
The encoding to be used when no other encoding information is available. |
BlackBerry 10.1.0
Q_SLOT void
Reset back to default encoding of ISO-8859-1.
BlackBerry 10.1.0
Signals
void
Emitted when the default font size changes.
| Parameters | |
|---|---|
| newDefaultFontSize |
The new default font size |
BlackBerry 10.0.0
void
Emitted when default font size begins or ends following system font size.
| Parameters | |
|---|---|
| newDefaultFontSizeFollowsSystemFontSize |
The new value of the setting. |
BlackBerry 10.0.0
void
Emitted when JavaScript enabled changes.
| Parameters | |
|---|---|
| enabled |
Whether JavaScript is enabled or not |
BlackBerry 10.0.0
void
Emitted when image downloading enabled changes.
| Parameters | |
|---|---|
| enabled |
Whether image downloading is enabled or not |
BlackBerry 10.0.0
void
Emitted when the minimum font size changes.
| Parameters | |
|---|---|
| newMinimumFontSize |
The new minimum font size |
BlackBerry 10.0.0
void
Emitted when the user agent string changes.
| Parameters | |
|---|---|
| newUserAgent |
The new user agent string |
BlackBerry 10.0.0
void
Emitted when the user style sheet location changes.
| Parameters | |
|---|---|
| newUserStyleSheetLocation |
The new user style sheet location |
BlackBerry 10.0.0
void
Emitted when web inspector enabled changes.
| Parameters | |
|---|---|
| enabled |
Whether the web inspector is enabled or disabled |
BlackBerry 10.0.0
void
Emitted when zoom to fit enabled changes.
| Parameters | |
|---|---|
| enabled |
Whether zoom to fit is enabled or disabled |
BlackBerry 10.0.0
bool
Emitted when active text matching enabled changes.
| Parameters | |
|---|---|
| enabled |
Whether active text matching is enabled or disabled |
BlackBerry 10.0.0
void
Emitted when the map of user viewport arguments changes.
| Parameters | |
|---|---|
| newViewportArguments |
The new map of user viewport arguments |
BlackBerry 10.0.0
void
Emitted when the background setting changes.
The newBackground QVariant provided wraps a bb::cascades::Paint instance.
| Parameters | |
|---|---|
| newBackground |
The new background |
BlackBerry 10.0.0
void
Emitted when web font downloading enabled changed.
| Parameters | |
|---|---|
| enabled |
Whether web font downloading is enabled or disabled. |
BlackBerry 10.0.0
void
Emitted when cookies enabled changed.
| Parameters | |
|---|---|
| enabled |
Whether cookies are enabled or disabled. |
BlackBerry 10.0.0
void
Emitted when the custom HTTP headers change.
| Parameters | |
|---|---|
| newCustomHttpHeaders |
The new custom HTTP headers |
BlackBerry 10.0.0
void
Emitted when the device pixel ratio changes.
| Parameters | |
|---|---|
| newDevicePixelRatio |
The new device pixel ratio |
BlackBerry 10.0.0
void
Emitted when credential auto fill changes.
| Parameters | |
|---|---|
| enabled |
Whether credential auto fill is enabled. |
BlackBerry 10.1.0
void
Emitted when form auto fill changes.
| Parameters | |
|---|---|
| enabled |
Whether form auto fill is enabled. |
BlackBerry 10.1.0
void
Emitted when the default character encoding changes.
| Parameters | |
|---|---|
| codec |
The new default character encoding. |
BlackBerry 10.1.0