QtWebkit 및 Google지도를 실험하고 있습니다. QWebView에서 C++ 슬롯을 호출하면 문제가 발생합니다.Google지도 마커가 클릭 이벤트를받지 못합니다.
<!DOCTYPE html>
<html>
<head>
<title>Google Maps JavaScript API v3 Example: Event Simple</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="UTF-8">
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=true"></script>
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#map_canvas { height: 100% }
</style>
<script type="text/javascript">
function initialize() {
var myOptions = {
zoom: 4,
center: new google.maps.LatLng(-25.363882, 131.044922),
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById('map_canvas'),
myOptions);
var marker = new google.maps.Marker({
position: map.getCenter(),
map: map,
title: 'test'
});
google.maps.event.addListener(marker, 'click', function() {
//if (map.getZoom() == 8) {
// map.setZoom(4);
// } else {
// map.setZoom(8);
// }
window.maiWi.showList();
});
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="map_canvas" style="width:100%; height:100%"></div>
</body>
</html>
maiWi이 슬롯 showList를() 내가 전화를 원하고있는이 자바 스크립트 창 개체에 추가되었습니다 포함 QMainWindow 객체 인 다음 QWebView에 표시 페이지는 수정 된 Google지도 예이다.
onclick = "maiWi.showList()"속성을 가진 다른 요소를 웹 페이지에 추가하면 슬롯이 호출되고 모든 것이 잘됩니다. 그러나지도 표시가 클릭되면 슬롯을 호출하고 싶습니다. 그러나 마커는 QWebView의 클릭 이벤트에 응답하지 않는 것 같습니다. 주석 처리 된 예제 코드조차도 작동하지 않습니다.
크롬에서는 이벤트 리스너가 호출되어 예상 한대로 작동하지만 QWebView에서는 아무 것도 발생하지 않습니다.
같은 문제가 발생했습니다. – bennedich