I'am triying to get the results of a googlemap function, from the javascript code back to the c++ source code in order to process those results. But no success.
I have an html page which I load inside a class derived from QWebView. The html page I load inside the WebView is:
Qt Code:
  1. <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=GOOGLE_MAPS_KEY"
  2. type="text/javascript"></script>
  3. <script type="text/javascript">
  4.  
  5. var map;
  6. var geocoder;
  7. var Lat,Lng;
  8.  
  9. function initialize()
  10. {
  11. if (GBrowserIsCompatible())
  12. {
  13. map = new GMap2(document.getElementById("map"));
  14. //
  15. map.addControl(new GSmallMapControl);
  16. map.addControl(new GMapTypeControl);
  17. geocoder = new GClientGeocoder();
  18. map.setCenter( new GLatLng(0,0),1 );
  19. GEvent.addListener(map, "click", getAddress);
  20. }
  21.  
  22. }
  23.  
  24. function getAddress(overlay, latlng) {
  25.  
  26. if (latlng != null) {
  27.  
  28. address = latlng;
  29.  
  30. geocoder.getLocations(latlng, showAddress);
  31.  
  32. }
  33. }
  34. function showAddress(response) {
  35. map.clearOverlays();
  36. if (!response || response.Status.code != 200) {
  37. alert("Status Code:" + response.Status.code);
  38. } else {
  39. place = response.Placemark[0];
  40. point = new GLatLng(place.Point.coordinates[1],place.Point.coordinates[0]);
  41. marker = new GMarker(point);
  42. map.addOverlay(marker);
  43. marker.openInfoWindowHtml(
  44. '<b>orig latlng:</b>' + response.name + '<br/>' +
  45. '<b>latlng:</b>' + place.Point.coordinates[1] + "," + place.Point.coordinates[0] + '<br>' +
  46. '<b>Status Code:</b>' + response.Status.code + '<br>' +
  47. '<b>Status Request:</b>' + response.Status.request + '<br>' +
  48. '<b>Address:</b>' + place.address + '<br>' +
  49. '<b>Accuracy:</b>' + place.AddressDetails.Accuracy + '<br>' +
  50. '<b>Country code:</b> ' + place.AddressDetails.Country.CountryNameCode);
  51. Lat = place.Point.coordinates[1];
  52. Lng = place.Point.coordinates[2];
  53. Name= plcae.AddressDetails.Country.AdmninistrativeArea.Locality;
  54. Map.setValues(Lat, Lng, Name);
  55.  
  56. }
  57. }
  58. function Open(x,y)
  59. {
  60. map.setCenter( new GLatLng(x,y),13 );
  61. }
  62. </script>
  63.  
  64. </head>
  65. <body onload="initialize()" onunload="GUnload()" topmargin="0" leftmargin="0">
  66. <div id="map" style="width: 341px; height: 271px"></div>
  67. </body>
  68. </html>
To copy to clipboard, switch view to plain text mode 

In my c++ code I have
Qt Code:
  1. this->page()->mainFrame()->addToJavaScriptWindowObject("Map", this);
  2. connect(page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()),
  3. this, SLOT(populateJavaScriptWindowObject()));
  4. .....
  5. void Map::geoCode(QString local)
  6. {
  7. clearCoordinates();
  8. // qDebug()<<"Map finding..."<<local;
  9. QString requestStr( tr("http://maps.google.com/maps/geo?q=%1&output=%2&key=%3")
  10. .arg(local)
  11. .arg("csv")
  12. .arg("GOOGLE_MAPS_KEY") );
  13.  
  14. manager->get( QNetworkRequest(requestStr) );
  15. ++pendingRequests;
  16. }
  17. ...
  18. void Map::populateJavaScriptWindowObject()
  19. {
  20. this->page()->mainFrame()->addToJavaScriptWindowObject("Map", this);
  21.  
  22. }
  23. void Map::setValues(const QString &latitude, const QString &longitude, const QString &n)
  24. {
  25. lat = latitude.toDouble();
  26. lon = longitude.toDouble();
  27. name = n;
  28. qDebug()<<"MAP new values available";
  29. }
To copy to clipboard, switch view to plain text mode 
So, I am expecting that when I click on a point in the google map the javascript calls the object Map, which I exported with the addToJavaScriptWindowObject.
But, nothing: I double click on a point, the map change but it seems that the setValues faunction is not call at all.