I have a QML app where I add features every 5 seconds getting the GPS point coordinates using 'LocationDisplay QML Type'. I cannot disconnect the trigger (related with 'Timer' object) once connected.. I created a 'Timer' object in order to loop this feature creation. I want to call the disconnect when => 'locationDisplay.stop()'. Whether with a button I call the 'addFunctionality("stopMode")' function, the trigger is still running..
Timer {
id: timer
interval: 5000;
repeat: true;
running: true;
}
function addFunctionality(arg) {
if(arg === "compassMode"){
mapView.locationDisplay.autoPanMode = Enums.LocationDisplayAutoPanModeCompassNavigation;
mapView.locationDisplay.start();
}else if(arg === "navigationMode"){
mapView.locationDisplay.autoPanMode = Enums.LocationDisplayAutoPanModeNavigation;
mapView.locationDisplay.start();
var featureAttributes = {"XXXX" : "XXXX"};
timer.start();
timer.triggered.connect(function () {
mapView.locationDisplay.autoPanMode = Enums.LocationDisplayAutoPanModeRecenter;
var point = mapView.locationDisplay.mapLocation;
var feature = featureTable.createFeatureWithAttributes(featureAttributes, point);
featureTable.addFeature(feature);
})
}else{
mapView.locationDisplay.stop();
}
}
A.