From f2608edc5662f4e2c5afeb83eb395c25bfc4a18a Mon Sep 17 00:00:00 2001 From: "Lubomir I. Ivanov" Date: Wed, 19 Jul 2017 02:36:59 +0300 Subject: 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 --- mobile-widgets/qml/MapWidget.qml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/mobile-widgets/qml/MapWidget.qml b/mobile-widgets/qml/MapWidget.qml index ce057d63e..7249ed632 100644 --- a/mobile-widgets/qml/MapWidget.qml +++ b/mobile-widgets/qml/MapWidget.qml @@ -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 + } + } } } -- cgit v1.2.3-70-g09d2