我使用 MapQuickItem 作为地图上的委托组件。我有三个组件。单击组件时,我想更改委托组件的颜色。其余颜色相同。如何更改仅选定组件颜色的颜色
Plugin
{
id: hereMaps
name: "here"
PluginParameter { name: "here.app_id"; value: "oBB4FivcP23m2UZQCj8K" }
PluginParameter { name: "here.token"; value: "P-D8XRRGeVt0YphUuOImeA" }
}
Map {
id: map
anchors.fill: parent
activeMapType: supportedMapTypes[1];
zoomLevel: 18
plugin: hereMaps
center: QtPositioning.coordinate(19.997454, 73.789803)
MapItemView {
id: markerItem
model: [
{ id: "marker1", color: "red" },
{ id: "marker2", color: "red" },
{ id: "marker3", color: "red" }
]
delegate: mapMarkerComponent
}
Component {
id : mapMarkerComponent
MapQuickItem {
id: mapMarker
coordinate: QtPositioning.coordinate(19.997454, 73.789803)
sourceItem: Rectangle {
id: handle
color: modelData.color
width: 40
height: 40
MouseArea {
drag.target: parent
anchors.fill: parent
onClicked: {
handle.color = "green"
}
}
}
onCoordinateChanged: {
console.log(modelData.id + ":" + coordinate);
}
}
}
}