[SailfishDevel] ListModel doesnt accept point types in sailfish
joao morgado
joaodeusmorgado at yahoo.com
Mon May 14 15:20:31 UTC 2018
Hi Michael & devel list
Thanks for the link, I did a bit of googling before asking but didnt remember to check the source code.Still dont know why it worked for desktop and android, but now it's bullet proof for all plataforms :) Solved!!!
CheersJoão
Em segunda-feira, 14 de maio de 2018 14:21:38 GMT+1, Michael Fuchs <michfu at gmx.at> escreveu:
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
>
_______________________________________________
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscribe at lists.sailfishos.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.sailfishos.org/pipermail/devel/attachments/20180514/ec5795da/attachment.html>
More information about the Devel
mailing list