mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
d1e7e6e699
commit
4c7ce5c1aa
1 changed files with 18 additions and 20 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue