diff options
author | Lubomir I. Ivanov <neolit123@gmail.com> | 2017-07-19 02:36:59 +0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-07-28 07:31:11 -0700 |
commit | f2608edc5662f4e2c5afeb83eb395c25bfc4a18a (patch) | |
tree | c6c5341d7cb59ffa2368449e553ac950f0a8007b | |
parent | 4b03216fdb7c8e915b0d4368ff9df74f810c4760 (diff) | |
download | subsurface-f2608edc5662f4e2c5afeb83eb395c25bfc4a18a.tar.gz |
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>
-rw-r--r-- | mobile-widgets/qml/MapWidget.qml | 12 |
1 files changed, 11 insertions, 1 deletions
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 + } + } } } |