Qt WebKit and HTML5 geolocation | Qt Project forums | Qt Project
Qt WebKit and HTML5 geolocation | Qt Project forums | Qt Project
Qt WebKit and HTML5 geolocation
I’m learning HTML5 and testing the new features on a Qt hybrid application.
Now I’m working on a simple geolocation example but when I call navigator.geolocation.getCurrentPosition(displayLocation); it seems the QtWebKit does not support it, but acording to this http://trac.webkit.org/wiki/QtWebKitFeatures22 the version of QtWebKit that comes with Qt4.8.0 supports geolocation.This is the code I’m using:
window.onload = function() { getMyLocation(); } function getMyLocation() { if(navigator.geolocation) { navigator.geolocation.getCurrentPosition(displayLocation); } else { alert("No geolocation support"); } } function displayLocation(position) { var latitude = position.coords.latitude; var longitude = position.coords.longitude; var div = document.getElementById("location"); div[removed] = "You are at Latitude: " + latitude + ", Longitude: " + longitude; }
{ connect(web_view->page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(addJavascriptObject())); inspector_->setPage(web_view->page()); inspector_->setVisible(true); inspector_->show(); return web_view; }
Anyone knows how to enable geolocation for a desktop app?
Qt WebKit and HTML5 geolocation | Qt Project forums | Qt Project,古老的榕树,5-wow.com
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。