summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
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{}}
+ }
}