diff options
author | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2010-02-17 03:20:09 (GMT) |
---|---|---|
committer | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2010-02-17 03:20:09 (GMT) |
commit | 4cd7e2ebd675fdc0b00d9a29f64e4189e74f7656 (patch) | |
tree | 9db3085e15487c4b0580035eeb0b262b0ada5920 /examples/declarative/webview/content | |
parent | d1d81d48dff6b3285d9016d8f3354630926463d8 (diff) | |
parent | fd3f9dd0f31efeea3aa0ec28b54c70d85712c7ba (diff) | |
download | Qt-4cd7e2ebd675fdc0b00d9a29f64e4189e74f7656.zip Qt-4cd7e2ebd675fdc0b00d9a29f64e4189e74f7656.tar.gz Qt-4cd7e2ebd675fdc0b00d9a29f64e4189e74f7656.tar.bz2 |
Merge remote branch 'origin/master' into bearermanagement/unit-tests
Diffstat (limited to 'examples/declarative/webview/content')
-rw-r--r-- | examples/declarative/webview/content/Mapping/Map.qml | 40 | ||||
-rwxr-xr-x | examples/declarative/webview/content/Mapping/map.html | 94 |
2 files changed, 67 insertions, 67 deletions
diff --git a/examples/declarative/webview/content/Mapping/Map.qml b/examples/declarative/webview/content/Mapping/Map.qml index aae6b5d..2e98940 100644 --- a/examples/declarative/webview/content/Mapping/Map.qml +++ b/examples/declarative/webview/content/Mapping/Map.qml @@ -1,20 +1,20 @@ -import Qt 4.6
-
-Item {
- id: page
- property real latitude: -34.397
- property real longitude: 150.644
- property string address: ""
- WebView {
- id: map
- anchors.fill: parent
- url: "map.html"
- javaScriptWindowObjects: QtObject {
- WebView.windowObjectName: "qml"
- property real lat: page.latitude
- property real lng: page.longitude
- property string address: page.address
- onAddressChanged: {map.evaluateJavaScript("goToAddress()")}
- }
- }
-}
+import Qt 4.6 + +Item { + id: page + property real latitude: -34.397 + property real longitude: 150.644 + property string address: "" + WebView { + id: map + anchors.fill: parent + url: "map.html" + javaScriptWindowObjects: QtObject { + WebView.windowObjectName: "qml" + property real lat: page.latitude + property real lng: page.longitude + property string address: page.address + onAddressChanged: {map.evaluateJavaScript("goToAddress()")} + } + } +} diff --git a/examples/declarative/webview/content/Mapping/map.html b/examples/declarative/webview/content/Mapping/map.html index 8afa21c..72f426a 100755 --- a/examples/declarative/webview/content/Mapping/map.html +++ b/examples/declarative/webview/content/Mapping/map.html @@ -1,47 +1,47 @@ -<html>
-<head>
-<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
-<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
-<script type="text/javascript">
- var geocoder
- var map
- function goToLatLng(latlng,bounds) {
- if (map) {
- map.setCenter(latlng)
- map.fitBounds(bounds)
- } else {
- var myOptions = {
- zoom: 8,
- center: latlng,
- mapTypeId: google.maps.MapTypeId.ROADMAP
- };
- map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
- }
- }
- function initialize() {
- geocoder = new google.maps.Geocoder();
- if (window.qml.address) {
- goToAddress()
- } else {
- goToLatLng(new google.maps.LatLng(window.qml.lat,window.qml.lng));
- }
- }
- function goToAddress() {
- if (geocoder) {
- var req = {
- address: window.qml.address,
- }
- if (map)
- req.bounds = map.getBounds()
- geocoder.geocode(req, function(results, status) {
- if (status == google.maps.GeocoderStatus.OK)
- goToLatLng(results[0].geometry.location,results[0].geometry.bounds);
- });
- }
- }
-</script>
-</head>
-<body onload="initialize()" leftmargin="0px" topmargin="0px" marginwidth="0px" marginheight="0px">
- <div id="map_canvas" style="width:100%; height:100%"></div>
-</body>
-</html>
+<html> +<head> +<meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> +<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> +<script type="text/javascript"> + var geocoder + var map + function goToLatLng(latlng,bounds) { + if (map) { + map.setCenter(latlng) + map.fitBounds(bounds) + } else { + var myOptions = { + zoom: 8, + center: latlng, + mapTypeId: google.maps.MapTypeId.ROADMAP + }; + map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); + } + } + function initialize() { + geocoder = new google.maps.Geocoder(); + if (window.qml.address) { + goToAddress() + } else { + goToLatLng(new google.maps.LatLng(window.qml.lat,window.qml.lng)); + } + } + function goToAddress() { + if (geocoder) { + var req = { + address: window.qml.address, + } + if (map) + req.bounds = map.getBounds() + geocoder.geocode(req, function(results, status) { + if (status == google.maps.GeocoderStatus.OK) + goToLatLng(results[0].geometry.location,results[0].geometry.bounds); + }); + } + } +</script> +</head> +<body onload="initialize()" leftmargin="0px" topmargin="0px" marginwidth="0px" marginheight="0px"> + <div id="map_canvas" style="width:100%; height:100%"></div> +</body> +</html> |