MightTower
4th December 2010, 18:49
Hi,
i try to show Google Maps in a QWebView (this works) and to play around with a marker. The html code for the WebView is:
<html>
<head>
<script type="text/javascript" src="http://www.google.com/jsapi?autoload={'modules':[{name:'maps',version:3,other_params:'sensor=false' }]}"></script>
<script type="text/javascript">
function initialize() {
var latlng = new google.maps.LatLng(-34.397, 150.644);
var myOptions = {
zoom: 8,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP,
mapTypeControlOptions: {
style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
},
navigationControlOptions: {
style: google.maps.NavigationControlStyle.ZOOM_PAN
},
scaleControl: true
};
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
var distanceWidget = new DistanceWidget(map);
}
function DistanceWidget(map) {
this.set('map', map);
this.set('position', map.getCenter());
var marker = new google.maps.Marker({
draggable: true,
title: 'Move me!'
});
// Bind the marker map property to the DistanceWidget map property
marker.bindTo('map', this);
// Bind the marker position property to the DistanceWidget position
// property
marker.bindTo('position', this);
}
DistanceWidget.prototype = new google.maps.MVCObject();
</script>
</head>
<body onload="initialize()">
<div id="map_canvas" style="width: 100%; height: 100%"></div>
</body>
</html>
My problem is that in the WebView i can not drag & drop the marker, with the Fancy Browser example of QT its the same.
If I try to load the page with IE, Firefox or Chrome it works as supposed.
Some one know what i can do or where is the problem?
Thanks,
Marc
i try to show Google Maps in a QWebView (this works) and to play around with a marker. The html code for the WebView is:
<html>
<head>
<script type="text/javascript" src="http://www.google.com/jsapi?autoload={'modules':[{name:'maps',version:3,other_params:'sensor=false' }]}"></script>
<script type="text/javascript">
function initialize() {
var latlng = new google.maps.LatLng(-34.397, 150.644);
var myOptions = {
zoom: 8,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP,
mapTypeControlOptions: {
style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
},
navigationControlOptions: {
style: google.maps.NavigationControlStyle.ZOOM_PAN
},
scaleControl: true
};
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
var distanceWidget = new DistanceWidget(map);
}
function DistanceWidget(map) {
this.set('map', map);
this.set('position', map.getCenter());
var marker = new google.maps.Marker({
draggable: true,
title: 'Move me!'
});
// Bind the marker map property to the DistanceWidget map property
marker.bindTo('map', this);
// Bind the marker position property to the DistanceWidget position
// property
marker.bindTo('position', this);
}
DistanceWidget.prototype = new google.maps.MVCObject();
</script>
</head>
<body onload="initialize()">
<div id="map_canvas" style="width: 100%; height: 100%"></div>
</body>
</html>
My problem is that in the WebView i can not drag & drop the marker, with the Fancy Browser example of QT its the same.
If I try to load the page with IE, Firefox or Chrome it works as supposed.
Some one know what i can do or where is the problem?
Thanks,
Marc