Enabling/Disabling dynamically QML map panning
-
Hi,
I need to disable and enable panning on my QML map dynamically.
In more detail, I need with the press of the button to be able to suppress panning and then to do the opposite with another button.
I had a look online but I cannot find anything that helps or at least I did not spot it.Is there a way to do it?
Thank you.
-
@skats said in Enabling/Disabling dynamically QML map panning:
Hi,
I need to disable and enable panning on my QML map dynamically.
In more detail, I need with the press of the button to be able to suppress panning and then to do the opposite with another button.
I had a look online but I cannot find anything that helps or at least I did not spot it.Is there a way to do it?
Thank you.
I think you need to look at the MapGestureArea.
From the documentation, it seems you can just set gesture.enabled on your Map object to enable/disable map gestures. So if you connect a button to this property, I expect it would work
Map{ id: map } Button{ id: suppress onClicked: map.gestures.enabled = false } Button{ id: enable onClicked: map.gestures.enabled = true }
I think something like this should work, although I haven't tested it myself or ever used maps for that matter, so I could be wrong.
Also, maybe instead of two buttons you could use one checkable button (or a slider or checkbox)
Map{ id: map map.gestures.enabled: button.checked } Button{ id: button checkable: true }