1
我使用QWebView顯示加載谷歌地圖的簡單html頁面。但是,當拖動地圖時,它在加載圖像時非常緩慢,而且看起來並不像它緩存它們,因爲它第二次放慢速度也會緩慢移動。QWebView:使用谷歌地圖拖動地圖時極其滯後
任何人看到類似的東西,並得到了解決辦法?
#define MAP_HTML "<html><head><script type=\"text/javascript\" " \
"src=\"http://maps.googleapis.com/maps/api/js?sensor=false\"></script>" \
"<script type=\"text/javascript\">" \
"var map; function initialize(lat, lng) { "\
"map = new google.maps.Map(document.getElementById(\"map_canvas\"), " \
"{ zoom: 15, center: new google.maps.LatLng(lat, lng), " \
"disableDefaultUI: true, mapTypeId: google.maps.MapTypeId.ROADMAP });" \
"} </script>" \
"</head><body style=\"margin:0px; padding:0px;\" onload=\"initialize(55.786033,12.521667)\">" \
"<div id=\"map_canvas\" style=\"width:100%; height:100%\"></div>" \
"</body></html>"
GMapWidget::GMapWidget(QWidget *parent)
: QWebView(parent)
, m_accessManager(new QNetworkAccessManager(this))
, m_initMap(false)
{
connect(m_accessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(slotNetworkReply(QNetworkReply*)));
connect(this, SIGNAL(loadFinished(bool)), this, SLOT(slotLoadFinished(bool)));
setHtml(MAP_HTML);
// auto t = QUrl::fromLocalFile("index.html").path();
// load(QUrl::fromLocalFile("index.html"));
}
它沒有改變任何東西。仍然在平移時,它需要加載圖像很慢。 – 2012-03-11 23:59:39