summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorChristian Strømme <christian.stromme@digia.com>2014-08-28 16:57:57 +0200
committerChristian Stromme <christian.stromme@digia.com>2014-09-02 11:02:49 +0200
commit48eba3767857d02bd03476b3944450bbf3e5c07d (patch)
tree701a026a196f0fc06b8cce0890bc58b4b0371ec0 /examples
parent671b8e79215e8d84becb508457586c7eebb229f6 (diff)
Improve the Look&Feel of the webview example
The example was not looking or behaving correctly on Android. Change-Id: Ic7e69c3cdf55e8ac4762794824ca7d9bc905cdc9 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/webview/webview/main.qml67
1 files changed, 25 insertions, 42 deletions
diff --git a/examples/webview/webview/main.qml b/examples/webview/webview/main.qml
index 57b3e7a..1553df8 100644
--- a/examples/webview/webview/main.qml
+++ b/examples/webview/webview/main.qml
@@ -40,64 +40,47 @@
import QtQuick 2.2
import QtQuick.Controls 1.1
-import QtQuick.Dialogs 1.2
import QtWebView 1.0
+import QtQuick.Layouts 1.1
ApplicationWindow {
- id: topLevel
visible: true
width: 640
height: 480
- title: qsTr("QtWebView Browser")
+ title: qsTr("QtWebView Example")
- Label {
- id: title
- anchors.top: parent.top
- anchors.left: parent.left
- anchors.right: parent.right
- horizontalAlignment: Label.AlignHCenter
- text: webView.title
- }
-
- Rectangle {
- id: addressBar
- anchors.top: title.bottom
- anchors.left: parent.left
- anchors.right: parent.right
- height: parent.height / 10
- color: "black"
+ toolBar: ToolBar {
+ id: navigationBar
+ RowLayout {
+ anchors.fill: parent
+ TextField {
+ Layout.fillWidth: true
+ id: urlField
+ inputMethodHints: Qt.ImhUrlCharactersOnly | Qt.ImhPreferLowercase
+ text: webView.url
+ }
- Button {
- id: goButton
- anchors.top: parent.top
- anchors.bottom: parent.bottom
- anchors.right: parent.right
- anchors.margins: topLevel.width / 30
- text: qsTr("Go")
- onClicked: {
- webView.url = utils.fromUserInput(addressField.text)
+ ToolButton {
+ id: goButton
+ text: qsTr("Go")
+ onClicked: {
+ webView.url = utils.fromUserInput(urlField.text)
+ }
}
}
+ }
- TextField {
- id: addressField
- anchors.top: parent.top
- anchors.bottom: parent.bottom
- anchors.left: parent.left
- anchors.right: goButton.left
- anchors.margins: topLevel.width / 30
+ statusBar: StatusBar {
+ id: statusBar
+ RowLayout {
+ anchors.fill: parent
+ Label { text: webView.loadProgress == 100 ? qsTr("Done") : qsTr("Loading: ") + webView.loadProgress + "%" }
}
}
WebView {
id: webView
- anchors.top: addressBar.bottom
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.bottom: parent.bottom
+ anchors.fill: parent
url: "http://qt-project.org"
- onUrlChanged: {
- addressField.text = url
- }
}
}