Hi,

This worked. I also had to stop using variant as a type (I also did read
the doc, which helps :-) ), and instead used basic types to directly
passed the needed values.

Thanks a lot.

Franck


Le 22/11/2013 03:18, Bea Lam a écrit :
> Hi Franck,
> 
> To get a reference to a particular instance of a delegate, just give the 
> delegate an id, and references to that id from within the delegate 
> declaration will refer to that instance only. The “this” keyword is not valid 
> in this context. (See 
> http://qt-project.org/doc/qt-5.0/qtqml/qtqml-javascript-hostenvironment.html.)
> 
> E.g.
> 
> GridView {
>       // …
> 
>       delegate: Card {
>               id: cardDelegate
>               onClicked: console.log(“You clicked:”, cardDelegate)
>       }
> }
> 
> If you click different cards in the view, you’ll see that each click prints 
> out a reference to a different Card object.
> 
> Though, if you only need to pass on some data from the model — for example, 
> the “ico” or “val” properties — it’s probably better to pass those details 
> instead of the Card delegate instance itself, as the GridView creates and 
> destroys its delegate instances as necessary when the view is scrolled. 
> However, this may not be a concern in your case if you are simply pushing 
> another page onto the stack at this point, and not changing the state of the 
> GridView.
> 
> cheers,
> 
> Bea
> _______________________________________________
> SailfishOS.org Devel mailing list
> 

_______________________________________________
SailfishOS.org Devel mailing list

Reply via email to