0

I am planning to display Maps in Web View of Nokia Qt SDK. Can I use Google Maps url to display maps and add annotations to certain locations. (Latitude and longitude)?

RK-
  • 12,099
  • 23
  • 89
  • 155

1 Answers1

0

You can use the Google maps API to display maps. Something like this displays the information popup:

<!DOCTYPE html>
<html>
<head>
<script type="text/javascript"
    src="http://maps.googleapis.com/maps/api/js?sensor=false">
</script>
<script type="text/javascript">
  function initialize() {
    var latlngmap_canvas = new google.maps.LatLng(45.819735,10.023033);
    var myOptionsmap_canvas = {
      zoom: 16,
      center: latlngmap_canvas,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    var mapmap_canvas = new google.maps.Map(document.getElementById("map_canvas"),
      myOptionsmap_canvas);
      var markermap_canvas = new google.maps.Marker({
                      map: mapmap_canvas, 
                      title: 'Title',  clickable: true,  
                      position: new google.maps.LatLng(45.819735,10.023033)
                       });
      var tooltipmap_canvas = '<div id="tooltip"><p><strong>Title</strong><br>Line of text</p></div>';
    var infowindowmap_canvas = new google.maps.InfoWindow({
      content: tooltipmap_canvas
    });
    google.maps.event.addListener(markermap_canvas, 'click', function() {
      infowindowmap_canvas.open(mapmap_canvas,markermap_canvas);
    });
  }

</script>
</head>
<body onload="initialize()">
  <div id="map_canvas" style="width:500px; height:400px"></div>
</body>
</html>

To add points on the map at runtime you can interact with javascript from your Qt code. Have a look here: Qt QWEBview JavaScript callback

Community
  • 1
  • 1
Paolo Iommarini
  • 219
  • 2
  • 9