I have a qt app with a qwebview that is using a google maps, there is no problem while initializing google maps; but when i try to add a marker like this:
ui->webView->page()->mainFrame()->evaluateJavaScript(QString("addmarker(-34.659639, -58.468231);"));
I get QVariant(Invalid).
My javascript code is as follows:
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
var map;
var marker;
var myLatlng = new google.maps.LatLng(-34, -58);
function initialize() {
var myOptions = {
zoom: 14,
center: new google.maps.LatLng(-34, -58),
mapTypeId: google.maps.MapTypeId.HYBRID,
zoomControl: true,
zoomControlOptions: { style: google.maps.ZoomControlStyle.SMALL },
};
map = new google.maps.Map(document.getElementById('map_canvas'), myOptions);
}
// Add a marker to the map and push to the array.
function addmarker(location) {
var Latlng = new google.maps.LatLng(location);
marker = new google.maps.Marker({
position: Latlng,
map: map,
title: "marker"
});
}
Please can any one help with this? Thanks in advance, Regards