Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to drag Map with mouse area while plotting waypoints on map in qml Android
QtWS25 Last Chance

How to drag Map with mouse area while plotting waypoints on map in qml Android

Scheduled Pinned Locked Moved Unsolved General and Desktop
qt qmlmouseareamapandriodzoomlevel
1 Posts 1 Posters 631 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.
  • H Offline
    H Offline
    HemantSuryawanshi
    wrote on last edited by HemantSuryawanshi
    #1

    I am using qt 5.14.1., SDK version 28 and ndk version 21. I am trying to drag the map with mouse area while plotting waypoints on map. Both dragging and plotting should be work on same time. I am able to plot waypoints successfully but cant able to drag map on same time and also giving problem in zoom in and zoom out of map while plotting the waypoint. I am using the following code

    Map {
                id: mapOfWorld
                anchors.centerIn: parent;
                anchors.fill: parent
                activeMapType: supportedMapTypes[1];
                plugin: hereMaps
    }   
            MouseArea {
                id: mapAreaClick
                focus: true
                anchors.rightMargin: 470
                transformOrigin: Item.Center
                anchors.horizontalCenterOffset: -1
                anchors.fill: mapOfWorld
                anchors.centerIn: mapOfWorld
                propagateComposedEvents : true
                preventStealing : true
                hoverEnabled: true
                drag.axis: Drag.XandYAxis
                drag.target: mapOfWorld
                onReleased: {
                       console.log("MouseArea onReleased")
                }
                // move or drag map        
                onPressAndHold: {
                    mapAreaClick.enabled = false
                    mapOfWorld.center = mapOfWorld.toCoordinate((Qt.point((mouse.x),(mouse.y))))
                    console.log("MouseArea onPressAndHold")
                }
                // plot the waypoint
                onPressed:  {
                    mapOfWorld.focus = true
                    mapAreaClick.enabled = true
                     var cordinate = mapOfWorld.toCoordinate((Qt.point((mouse.x),(mouse.y))));
                     Geofence.addGeoFenceAsset(cordinate)
                     }
                     }
    

    Is there some way to drag map and plot waypoints at same time in QT/QML.

    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