【发布时间】:2017-09-06 19:44:22
【问题描述】:
我有一个从AbstractListModel 派生的模型(markerModel),它具有三个角色status、position 和label。我通过在地图上画圆圈来展示它们。同时我想打印他们的position 和label n 一个矩形rectangle1。但是MapItemView 已经有一个代表了。一个模型可以有多个代表吗?
Map {
id: map
anchors.fill: parent
plugin: mapPlugin
center: QtPositioning.coordinate(22.5726, 88.3639)
zoomLevel: 14
MapItemView {
model: markerModel
delegate: markerDelegate
}
Component {
id: markerDelegate
MapQuickItem{
anchorPoint: Qt.point(2.5, 2.5)
coordinate: QtPositioning.coordinate(position.x, position.y)
zoomLevel: 0
sourceItem: Rectangle{
width: settings.marker_size;
height: settings.marker_size;
radius: settings.marker_size/2;
color: settings.marker_colors[status]
border.color: "white"
border.width: 1
}
}
}
}
Rectangle {
id: rectangle1
anchors.top: map.top
anchors.right: map.right
width: 500
height: 750
color: "#ffffff"
}
【问题讨论】: