0
我無法找到任何方式將MapCircle的半徑設置爲固定大小,同時縮放地圖。標記圖標用於PlaceSearchModel,但我無法使其動態化。當我縮小地圖時,它變得更大,當最小化地圖時,標記消失。如何將標記圖標或MapCircle動態設置爲Qt中地圖上當前位置的固定大小快速
下面是代碼:
import QtQuick 2.0
import QtQuick.Controls 2.0
import QtQuick.Controls.Material 2.0
import QtQuick.Controls.Universal 2.0
import Fluid.Controls 1.0
import QtLocation 5.6
import QtPositioning 5.6
TabbedPage {
id: frame
title: "Web Map"
Tab {
title: "Map Viewer"
anchors {
left: parent.left
top: parent.top
bottom: parent.bottom
}
width: parent.width
clip: true
Material.background: "white"
Material.elevation: 1
Universal.background: Universal.accent
Plugin {
id: mapPlugin
name: "osm"
}
Map {
id:map
anchors.fill: parent
plugin: mapPlugin
zoomLevel: 14
MapItemView {
model: src
delegate: MapQuickItem {
coordinate: src.position.coordinate
anchorPoint.x: image.width * 0.5
anchorPoint.y: image.height
sourceItem: Column {
Image { id: image; source: "marker.png" }
Text { text: title; font.bold: true }
}
}
}
MapCircle {
center : src.position.coordinate
radius: parent.width/10
border.width: 1
color: 'green'
}
}
PositionSource {
id: src
updateInterval: 1000
active: true
onPositionChanged: {
var coord = src.position.coordinate;
console.debug("current position:", coord.latitude, coord.longitude);
map.center = position.coordinate
}
}
}
}
截圖: