[SailfishDevel] ListModel doesnt accept point types in sailfish
Michael Fuchs
michfu at gmx.at
Mon May 14 13:21:29 UTC 2018
Hi Joao,
https://github.com/qt/qtdeclarative/blob/44a89492b49f23a975377795dbb7a48916cb5081/src/qml/types/qqmllistmodel.cpp#L2739
"Values must be simple constants; either strings (quoted and optionally
within a call to QT_TR_NOOP), boolean values (true, false), numbers, or
enumeration values (such as AlignText.AlignHCenter)."
...so I rather wonder, why it works on Android. ;)
br, Michael.
Am 14.05.2018 um 00:45 schrieb joao morgado via Devel:
> 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
>
> //obstaclesarerectanglesthatcannotbetransposed,likewallsforexample
>
> //listhetopleftcoordinate
>
> //risthebottomrightcoordinate
>
> }
>
>
> functionaddObstacle(l,r){
>
> //console.log("addingobstaclestolist")
>
> obstaclesList.append({"l":l,"r":r})
>
> }
>
>
> functionclearObstacles(){
>
> obstaclesList.clear()
>
> }
>
>
> functiongetObstacle(i){
>
> returnobstaclesList.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 ?
>
> Br
> João
>
>
> _______________________________________________
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to devel-unsubscribe at lists.sailfishos.org
>
More information about the Devel
mailing list