summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2010-03-23 02:04:41 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2010-03-23 02:04:41 (GMT)
commit9a41034cf05ad4c149e3a98dc8e39f5f6ad05d28 (patch)
tree1e1fb615c64666eb08d1a93c99f7fe80808958bc /examples
parentc3d8fef05b011a737ce15791e94aef84d27d1b8f (diff)
downloadQt-9a41034cf05ad4c149e3a98dc8e39f5f6ad05d28.zip
Qt-9a41034cf05ad4c149e3a98dc8e39f5f6ad05d28.tar.gz
Qt-9a41034cf05ad4c149e3a98dc8e39f5f6ad05d28.tar.bz2
Show loading progress
Task-number: QTBUG-9260
Diffstat (limited to 'examples')
-rw-r--r--examples/declarative/webview/content/Mapping/Map.qml7
-rwxr-xr-xexamples/declarative/webview/content/Mapping/map.html7
-rw-r--r--examples/declarative/webview/googleMaps.qml9
3 files changed, 21 insertions, 2 deletions
diff --git a/examples/declarative/webview/content/Mapping/Map.qml b/examples/declarative/webview/content/Mapping/Map.qml
index 6c3b021..38c42dd 100644
--- a/examples/declarative/webview/content/Mapping/Map.qml
+++ b/examples/declarative/webview/content/Mapping/Map.qml
@@ -6,16 +6,21 @@ Item {
property real latitude: -34.397
property real longitude: 150.644
property string address: ""
+ property alias status: js.status
WebView {
id: map
anchors.fill: parent
url: "map.html"
javaScriptWindowObjects: QtObject {
+ id: js
WebView.windowObjectName: "qml"
property real lat: page.latitude
property real lng: page.longitude
property string address: page.address
- onAddressChanged: {map.evaluateJavaScript("goToAddress()")}
+ property string status: "Loading"
+ onAddressChanged: { if (map.url != "" && map.progress==1) map.evaluateJavaScript("goToAddress()") }
}
+ pressGrabTime: 0
+ onLoadFinished: { evaluateJavaScript("goToAddress()"); }
}
}
diff --git a/examples/declarative/webview/content/Mapping/map.html b/examples/declarative/webview/content/Mapping/map.html
index 72f426a..a8726fd 100755
--- a/examples/declarative/webview/content/Mapping/map.html
+++ b/examples/declarative/webview/content/Mapping/map.html
@@ -33,9 +33,14 @@
}
if (map)
req.bounds = map.getBounds()
+ window.qml.status = "Loading";
geocoder.geocode(req, function(results, status) {
- if (status == google.maps.GeocoderStatus.OK)
+ if (status == google.maps.GeocoderStatus.OK) {
+ window.qml.status = "Ready";
goToLatLng(results[0].geometry.location,results[0].geometry.bounds);
+ } else {
+ window.qml.status = "Error";
+ }
});
}
}
diff --git a/examples/declarative/webview/googleMaps.qml b/examples/declarative/webview/googleMaps.qml
index a04fecb..a0926f5 100644
--- a/examples/declarative/webview/googleMaps.qml
+++ b/examples/declarative/webview/googleMaps.qml
@@ -21,6 +21,7 @@ Map {
radius: 5
anchors.bottom: parent.bottom
anchors.bottomMargin: 5
+ opacity: map.status == "Ready" ? 1 : 0
x: 70
TextInput {
id: input
@@ -29,4 +30,12 @@ Map {
Keys.onReturnPressed: map.address = input.text
}
}
+ Text {
+ id: loading
+ anchors.centerIn: parent
+ text: map.status == "Error" ? "Error" : "Loading"
+ opacity: map.status == "Ready" ? 0 : 1
+ font.pixelSize: 30
+ Behavior on opacity {NumberAnimation{}}
+ }
}