Qt Components Hildon  0.20
QML components for Maemo5 with Hildon styling.
 All Classes Functions Properties Groups Pages
Public Slots | Signals | Public Member Functions | Properties | List of all members
WebView Class Reference

Provides an item that is used to view and edit web documents. More...

Public Slots

void copy ()
 Copies the selected HTML to the clipboard.
void cut ()
 Copies the selected HTML to the clipboard and removes it from the web page.
bool findAllText (string text)
 Searches for all occurrances of text in the web page.
bool findText (string text)
 Searches for the next occurrance of text in the web page.
void paste ()
 Inserts the the clipboard's contents into the web page.

Signals

void downloadRequested (variant request)
 This signal is emitted when the user decides to download a link.
void unsupportedContent (variant content)
 This signal is emitted when WebKit cannot handle a link the user navigated to or a web server's response includes a "Content-Disposition" header with the 'attachment' directive.

Public Member Functions

variant hitTestContent (int x, int y)
 Performs a hit test at x,y, and returns the result.

Properties

bool forwardUnsupportedContent
 Whether to forward content that is not supported.
bool hasSelection
 Whether any text is selected in the web view.
string html
 The HTML of the web view.
QWebPage::LinkDelegationPolicy linkDelegationPolicy
 The policy used to determine how to handle activated links.
Component newWindowComponent
 The component used when a new window is requested.
int preferredHeight
 The preferred height of the web view.
int preferredWidth
 The preferred width of the web view.
int progress
 The loading progress of the web view.
string selectedText
 The selected text of the web view.
enumeration status
 The current status of the web view.
string statusText
 The status text of the web view.
string text
 The HTML of the web view as plain text.
string userAgent
 The user-agent string used when loading a web page.

Detailed Description

Provides an item that is used to view and edit web documents.

WebView is the main component of the org.hildon.webkit web browsing module. It can be used in various applications to display web content live from the internet.

import QtQuick 1.0
import org.hildon.components 1.0
import org.hildon.webkit 1.0
Window {
id: window
visible: true
title: webView.title ? webView.title : qsTr("WebView Example")
id: flickable
anchors {
left: parent.left
right: parent.right
top: parent.top
bottom: toolBar.top
}
contentHeight: webView.height
id: webView
preferredWidth: flickable.width
}
}
id: toolBar
anchors.bottom: parent.bottom
id: backButton
shortcut: "Backspace"
iconName: "general_back"
onClicked: webView.back()
}
id: forwardButton
shortcut: "Shift+Backspace"
iconName: "general_forward"
onClicked: webView.forward()
}
id: urlField
width: parent.width - 210
onAccepted: if (text) webView.url = text;
}
id: loadButton
shortcut: "Ctrl+R"
iconName: webView.status == WebView.Loading ? "general_stop" : "general_refresh"
onClicked: webView.status == WebView.Loading ? webView.stop() : webView.reload()
}
}
}
See Also
WebPage
Examples:
webview.qml.

Member Function Documentation

void WebView::copy ( )
slot

Copies the selected HTML to the clipboard.

See Also
WebPage::copy()
void WebView::cut ( )
slot

Copies the selected HTML to the clipboard and removes it from the web page.

See Also
WebPage::cut()
void WebView::downloadRequested ( variant  request)
signal

This signal is emitted when the user decides to download a link.

The url of the link as well as additional meta-information is contained in request.

See Also
unsupportedContent()
bool WebView::findAllText ( string  text)
slot

Searches for all occurrances of text in the web page.

Returns true if successful.

bool WebView::findText ( string  text)
slot

Searches for the next occurrance of text in the web page.

Returns true if successful.

void WebView::paste ( )
slot

Inserts the the clipboard's contents into the web page.

See Also
WebPage::paste()
void WebView::unsupportedContent ( variant  content)
signal

This signal is emitted when WebKit cannot handle a link the user navigated to or a web server's response includes a "Content-Disposition" header with the 'attachment' directive.

If "Content-Disposition" is present in content, the web server is indicating that the client should prompt the user to save the content regardless of content-type. See RFC 2616 sections 19.5.1 for details about Content-Disposition.

Note
This signal is only emitted if the forwardUnsupportedContent property is set to true.
See Also
downloadRequested()

Property Documentation

bool WebView::forwardUnsupportedContent
readwrite

Whether to forward content that is not supported.

If this property is set to true, the unsupportedContent() signal will be emitted when unsupported content is found.

QWebPage::LinkDelegationPolicy WebView::linkDelegationPolicy
readwrite

The policy used to determine how to handle activated links.

Possible values are:

Value Description
WebPage.DontDelegateLinks No links are delegated (default).
WebPage.DelegateExternalLinks When activating links that point to documents not stored on the local filesystem or an equivalent - such as the Qt resource system - then linkClicked() is emitted.
WebPage.DelegateAllLinks Whenever a link is activated the linkClicked() signal is emitted.
WebView::enumeration WebView::status
read

The current status of the web view.

Possible values are:

Value Description
WebView.Null No web page has been loaded (default).
WebView.Loading The web page is being loaded.
WebView.Ready The web page has been loaded.
WebView.Error An error occured when loading the web page.