2
Qt 5.4의 QML WebView 내에서 Google지도를 사용하려고합니다. 문제는 모든 것이 숨겨진 Flickable 객체에 의해 갇혀 있기 때문에 휠을 사용하여 스크롤하거나 맵을 팬 할 수 없다는 것입니다.QtWebKit 3.0 및 WebView 줌 및 팬 콘텐츠
다른 웹 사이트 로딩 중 문제가 발생했습니다. 콘텐츠를 확대/축소하려면 어떻게해야합니까? 어떻게지도를 패닝 할 수 있습니까?
이
내 QML입니다 :import QtQuick 2.3
import QtQuick.Window 2.2
import QtWebKit 3.0
import QtWebKit.experimental 1.0
import QtQuick.Controls 1.2
Window {
id: mainWindow
visible: true
width: 360
height: 360
Rectangle{
id: mainRect
anchors.fill: parent
WebView {
id: webview
url: "file:///C:/Qt/Tools/QtCreator/bin/testwebview/index.html"
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
height: parent.height-50
interactive: false
focus: true
contentWidth: webview.width
contentHeight: webview.height
experimental.preferences.javascriptEnabled: true
}
Button{
id: btn
anchors.top: webview.bottom
anchors.left:parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
text: "Push"
height: 50
onClicked: {
webview.experimental.evaluateJavaScript("var myLatlng = new google.maps.LatLng(-25.363882,131.044922);
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: 'Hello World!'
});");
}
}
}
}
이 내 index.hml
<html>
<head>
<title>Simple Map</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<style>
html, body, #map-canvas {
height: 100%;
margin: 0px;
padding: 0px
}
</style>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp"></script>
<script>
var map;
function initialize() {
var mapOptions = {
zoom: 8,
center: new google.maps.LatLng(-34.397, 150.644)
};
var myLatlng = new google.maps.LatLng(-25.363882,131.044922);
map = new google.maps.Map(document.getElementById('map-canvas'),
mapOptions);
function setMarker(){
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: 'Hello World!'
});
};
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="map-canvas"></div>
</body>
</html>
아주 많이는 관련이 경우