Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Enabling/Disabling dynamically QML map panning

Enabling/Disabling dynamically QML map panning

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 893 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    skats
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      stcorp
      wrote on last edited by
      #2

      @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
      }
      
      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved