mapwidget.qml: track the marker selection

Add a MouseArea to the MapItemView delagate and onClick set
the "mapHelper.model.selectedUuid" to the uuid of the clicked marker.
This updates the "selectedUuid" property inside MapLocationModel.

Based on "mapHelper.model.selectedUuid" it is now possible to
show two seprate images for selected / deselected markers.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
Lubomir I. Ivanov 2017-07-19 02:36:59 +03:00 committed by Dirk Hohndel
parent 4b03216fdb
commit f2608edc56

View file

@ -38,7 +38,17 @@ Item {
anchorPoint.x: 0
anchorPoint.y: mapItemImage.height
coordinate: model.coordinate
sourceItem: Image { id: mapItemImage; source: "qrc:///mapwidget-marker-image" }
sourceItem: Image {
id: mapItemImage;
source: "qrc:///mapwidget-marker" + (mapHelper.model.selectedUuid === model.uuid ? "-selected" : "");
}
MouseArea {
anchors.fill: parent
onClicked: {
mapHelper.model.selectedUuid = model.uuid
}
}
}
}