PlacesUtils.js Example File | Qt Location 5.4

- Qt 5.4
- Qt Location
- Places (QML)
- PlacesUtils.js Example File
- Qt 5.4.2 Reference Documentation

# PlacesUtils.js Example File

places/content/places/PlacesUtils.js

    .pragma library

    function prettyDistance(distance) {
        if (distance < 1000)
            return distance.toFixed(0) + "m";

        var km = distance/1000;
        if (km < 10)
            return km.toFixed(1) + "km";

        return km.toFixed(0) + "km";
    }