Is there any way to capture the mouse movement over a MapView?
The mousePositionChanged signal documentation is slightly mis-leading, because it only fires when the mouse button is held down while the mouse is moved. I'm looking for a signal similar to the onPositionChanged signal of a MouseArea.
I tried placing a MouseArea over my mapview, but then nothing propagates through to the MapView, i.e. can't pan or click (although mouse wheel zooming seems to work!?). I tried manually triggering all the MapView mouse signals (e.g. whenever the mouse area pressed signal fires I called mapView.mousePressed(mouse) etc) but still couldn't pan/move the map around.
So I guess I'm asking for either of two things:
1) a way to capture the mouse hover movement over a MapView so I don't have to use a MouseArea at all (my preference)
2) a way to place a MouseArea over a MapView to capture the mouse hover movement but still be able to navigate the map underneath.
mousePositionChanged(MouseEvent mouse) |
Emitted when the mouse is moved over the GeoView.
Solved! Go to Solution.
Looks like we need to add some clarification to our doc. You can accomplish this with a MouseArea and accepting the mouse events to let everything propagate through.
MapView {
id: mapView
anchors.fill: parent
// add a map to the mapview
Map {
// add the BasemapTopographic basemap to the map
BasemapTopographic {}
}
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
onMouseXChanged: {
console.log(mouse.x, mouse.y)
}
onPressed: mouse.accepted = false
}
}
Looping in ArcGIS Runtime SDK for Qt to see if people in that group have an explanation to the mis-leading documentation and explanation on the mouse event.
Looks like we need to add some clarification to our doc. You can accomplish this with a MouseArea and accepting the mouse events to let everything propagate through.
MapView {
id: mapView
anchors.fill: parent
// add a map to the mapview
Map {
// add the BasemapTopographic basemap to the map
BasemapTopographic {}
}
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
onMouseXChanged: {
console.log(mouse.x, mouse.y)
}
onPressed: mouse.accepted = false
}
}