[SailfishDevel] ListModel doesnt accept point types in sailfish

joao morgado joaodeusmorgado at yahoo.com
Sun May 13 22:45:06 UTC 2018


Hi there
I tried to save a point type in a listmodel but when reading the value from the list I get a error saying something like "undefined". This error happens in my intex aqua fish.It does work on desktop and android.
My code is something like this:
    ListModel {        id: obstaclesList        //obstacles are rectangles that cannot be transposed, like walls for example        //l is the top left coordinate        //r is the bottom right coordinate    }
    function addObstacle(l, r) {        //console.log("adding obstacles to list")        obstaclesList.append({"l": l, "r": r})    }
    function clearObstacles() {        obstaclesList.clear()    }
    function getObstacle(i) {        return obstaclesList.get(i)    }
......
obstaclesList.addObstacle(mountain.baseTL, mountain.baseBR) // baseTL and baseBR are Qt.point(....)
....obstaclesList.getObstacle(i).l // <- this line is where it fails
I solve this problem by changing the code to add / get real types instead of point. Just curious why this happen, inititally I tought it could be some arm limitation, but it does work good on a android mobile phone. Any ideias ?
BrJoão
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.sailfishos.org/pipermail/devel/attachments/20180513/d48fd7d2/attachment.html>


More information about the Devel mailing list