WebEngineView QML Type
A WebEngineView renders web content within a QML application. More...
Import Statement: | import QtWebEngine 1.0 |
Since: | QtWebEngine 1.0 |
Properties
- ErrorDomain : enumeration
- JavaScriptConsoleMessageLevel : enumeration
- LoadStatus : enumeration
- canGoBack : bool
- canGoForward : bool
- icon : url
- loadProgress : int
- loading : bool
- title : string
- url : url
Signals
- linkHovered(hoveredUrl, hoveredTitle)
- loadingChanged(loadRequest)
Methods
- void goBack()
- void goForward()
- void loadHtml(string html, url baseUrl)
- void reload()
- void runJavaScript(string script, variant callback)
- void stop()
Detailed Description
Property Documentation
This enumeration details various high-level error types.
Constant | Description |
---|---|
NoErrorDomain | |
WebEngineView::InternalErrorDomain | Content fails to be interpreted by Qt WebEngine. |
WebEngineView::ConnectionErrorDomain | Error results from faulty network connection. |
WebEngineView::CertificateErrorDomain | Error related to the SSL/TLS certficate. |
WebEngineView::HttpErrorDomain | Error related to the HTTP connection. |
WebEngineView::FtpErrorDomain | Error related to the FTP connection. |
WebEngineView::DnsErrorDomain | Error related to the DNS connection. |
Indicates the severity of a JavaScript console message.
Constant | Description |
---|---|
InfoMessageLevel | Message is purely informative and should be safe to ignore. |
WarningMessageLevel | Message indicates there might be a problem that may need attention. |
ErrorMessageLevel | Message indicates there has been an error. |
Reflects a page's load status.
Constant | Description |
---|---|
LoadStartedStatus | Page is currently loading. |
LoadSucceededStatus | Page has successfully loaded, and is not currently loading. |
LoadFailedStatus | Page has failed to load, and is not currently loading. |
read-onlyicon : url |
This property holds the location of the currently displaying web site icon, also known as favicon or shortcut icon. This read-only URL corresponds to the image used within a mobile browser application to represent a bookmarked page on the device's home screen.
The following snippet uses the icon
property to build an Image
component:
Image { id: appIcon source: webView.icon != "" ? webView.icon : "fallbackFavIcon.png"; ... }
This property holds the amount of the page that has been loaded, expressed as an integer percentage in the range from 0
to 100
.
This property holds the title of the currently displaying HTML page, a read-only value that reflects the contents of the <title>
tag.
url : url |
The location of the currently displaying HTML page. This writable property offers the main interface to load a page into a web view. It functions the same as the window.location
DOM property.
See also WebEngineView::loadHtml().
Signal Documentation
Within a mouse-driven interface, this signal is emitted when a mouse pointer passes over a link, corresponding to the mouseover
DOM event. This event may also occur in touch interfaces for mouseover
events that are not cancelled with preventDefault()
. hoveredUrl provides the link's location, and hoveredTitle is any available link text.
The corresponding handler is onLinkHovered.
This signal is emitted when a page load begins, ends, or fails. The corresponding handler is onLoadingChanged.
When handling the signal with onLoadingChanged, various read-only parameters are available on the loadRequest:
Property | Description |
---|---|
url | The location of the resource that is loading. |
status | Reflects one of four load states: WebEngineView::LoadStartedStatus , WebEngineView::LoadStoppedStatus , WebEngineView::LoadSucceededStatus , or WebEngineView::LoadFailedStatus . See WebEngineLoadRequest::status and WebEngineView::LoadStatus. |
errorString | The description of load error. |
errorCode | The HTTP error code. |
errorDomain | The high-level error types, one of WebEngineView::ConnectionErrorDomain , WebEngineView::HttpErrorDomain , WebEngineView::InternalErrorDomain , WebEngineView::DownloadErrorDomain , or WebEngineView::NoErrorDomain . See WebEngineView::ErrorDomain for the full list. |
See also WebEngineView::loading.
Method Documentation
Go backward within the browser's session history, if possible. This function is equivalent to the window.history.back()
DOM method.
See also WebEngineView::canGoBack.
Go forward within the browser's session history, if possible. This function is equivalent to the window.history.forward()
DOM method.
void loadHtml(string html, url baseUrl) |
Loads the specified html as the content of the web view.
This method offers a lower-level alternative to the url
property, which references HTML pages via URL.
External objects such as stylesheets or images referenced in the HTML document should be located relative to baseUrl. For example, if html is retrieved from http://www.example.com/documents/overview.html
, which is the base url, then an image referenced with the relative url, diagram.png
, should be at http://www.example.com/documents/diagram.png
.
See also WebEngineView::url.
Reloads the current page. This function is equivalent to the window.location.reload()
DOM method.
Runs the specified script in the content of the web view.
In case a callback function is provided it will be invoked after the script finished running.
runJavaScript("document.title", function(result) { console.log(result); });
© 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.