summaryrefslogtreecommitdiffstats
path: root/mobile-widgets/qml
diff options
context:
space:
mode:
authorGravatar Lubomir I. Ivanov <neolit123@gmail.com>2017-10-15 21:19:29 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-10-15 17:28:39 -0800
commit4c7ce5c1aa4493fa3bf03b3eee54606ab701cce9 (patch)
tree0675d1829df8877c41b93f9a749266f8320a2efd /mobile-widgets/qml
parentd1e7e6e69913d09f65a805cb3f1e6548e28e5999 (diff)
downloadsubsurface-4c7ce5c1aa4493fa3bf03b3eee54606ab701cce9.tar.gz
mapwidget.qml: fix weird MouseArea bug in MapItemView
The QML map uses MapItemView. MapItemView needs a delagate in the form of a MapQuickItem. The MapQuickItem needs a 'sourceItem' which would be used as the visual (e.g. marker) on the map. If the root sourceItem is of type Item, the marker becomes non-clickable. If the root sourceItem is an Image, the clicks work. This patch removes the root Item, which makes the code less organized, but at the same time it fixes the bug. Bug reproduced on the following Qt versions on Ubuntu: 5.5.x, 5.7.x Bug cannot be reproduced on Qt 5.9.x on Windows. Reported-by: Willem Ferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Diffstat (limited to 'mobile-widgets/qml')
-rw-r--r--mobile-widgets/qml/MapWidget.qml38
1 files changed, 18 insertions, 20 deletions
diff --git a/mobile-widgets/qml/MapWidget.qml b/mobile-widgets/qml/MapWidget.qml
index 7109b9dc3..140c279ff 100644
--- a/mobile-widgets/qml/MapWidget.qml
+++ b/mobile-widgets/qml/MapWidget.qml
@@ -49,27 +49,25 @@ Item {
anchorPoint.y: mapItemImage.height
coordinate: model.coordinate
z: mapHelper.model.selectedUuid === model.uuid ? mapHelper.model.count - 1 : 0
- sourceItem: Item {
- Image {
- id: mapItemImage
- source: "qrc:///mapwidget-marker" + (mapHelper.model.selectedUuid === model.uuid ? "-selected" : "")
- SequentialAnimation {
- id: mapItemImageAnimation
- PropertyAnimation { target: mapItemImage; property: "scale"; from: 1.0; to: 0.7; duration: 120 }
- PropertyAnimation { target: mapItemImage; property: "scale"; from: 0.7; to: 1.0; duration: 80 }
+ sourceItem: Image {
+ id: mapItemImage
+ source: "qrc:///mapwidget-marker" + (mapHelper.model.selectedUuid === model.uuid ? "-selected" : "")
+ SequentialAnimation {
+ id: mapItemImageAnimation
+ PropertyAnimation { target: mapItemImage; property: "scale"; from: 1.0; to: 0.7; duration: 120 }
+ PropertyAnimation { target: mapItemImage; property: "scale"; from: 0.7; to: 1.0; duration: 80 }
+ }
+ MouseArea {
+ drag.target: (mapHelper.editMode && mapHelper.model.selectedUuid === model.uuid) ? mapItem : undefined
+ anchors.fill: parent
+ onClicked: {
+ if (!mapHelper.editMode)
+ mapHelper.model.setSelectedUuid(model.uuid, true)
}
- MouseArea {
- drag.target: (mapHelper.editMode && mapHelper.model.selectedUuid === model.uuid) ? mapItem : undefined
- anchors.fill: parent
- onClicked: {
- if (!mapHelper.editMode)
- mapHelper.model.setSelectedUuid(model.uuid, true)
- }
- onDoubleClicked: map.doubleClickHandler(mapItem.coordinate)
- onReleased: {
- if (mapHelper.editMode && mapHelper.model.selectedUuid === model.uuid) {
- mapHelper.updateCurrentDiveSiteCoordinates(mapHelper.model.selectedUuid, mapItem.coordinate)
- }
+ onDoubleClicked: map.doubleClickHandler(mapItem.coordinate)
+ onReleased: {
+ if (mapHelper.editMode && mapHelper.model.selectedUuid === model.uuid) {
+ mapHelper.updateCurrentDiveSiteCoordinates(mapHelper.model.selectedUuid, mapItem.coordinate)
}
}
}