[Qt-interest] Unable to load Google maps in Qt widgets through QWebview and evaluateJavaScript function
Anisha Kaul
born.rebel.83 at gmail.com
Fri May 27 06:29:16 CEST 2011
I haven't mentioned the Google API Key, since I don't have a webpage or a
phone,
I am doing this on my computer on a qt widget.
The javascriot in the below slot doesn't seem to be doing anything.
Is there some other way of handling the same when you are NOT working on a
webpage?
Please guide.
void QGoogleMapView :: loadCoordinates ()
{
QStringList scriptStr;
scriptStr
<< "var map = new GMap2(document.getElementById(\"map\"));"
<< "var bounds = new GLatLngBounds;"
<< "var markers = [];"
<< "map.setCenter( new GLatLng(0,0),1 );";
int num=-1;
foreach( QPointF point, coordinates )
{
scriptStr << QString("markers[%1] = new GMarker(new GLatLng(%2,
%3));")
.arg(++num)
.arg(point.x())
.arg(point.y());
}
scriptStr
<< "for( var i=0; i<markers.length; ++i ) {"
<< " bounds.extend(markers[i].getPoint());"
<< " map.addOverlay(markers[i]);"
<< "}"
<< "map.setCenter(bounds.getCenter());";
this->page()->mainFrame()->evaluateJavaScript (scriptStr.join
("\n"));
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110527/f94c9f9f/attachment.html
More information about the Qt-interest-old
mailing list