AnsweredAssumed Answered

QML disable 'triggered.connect()'

Question asked by Adri2c on Aug 9, 2018
Latest reply on Aug 14, 2018 by Adri2c

Hi all,

 

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..

 

Any suggestions?

 

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();
            }
         }

 

Best

 

A.

Outcomes