[Qt-qml] Repeater inside delegate ?

Gregory Schlomoff gregory.schlomoff at gmail.com
Wed Jul 28 12:37:56 CEST 2010


I guess you may do that by nesting a new ListModel inside each
ListElement, but that's not really practical....

On Wed, Jul 28, 2010 at 5:34 PM, Stephen Collyer
<scollyer at netspinner.co.uk> wrote:
> Given a model like so:
>
>     ListModel
>     {
>         id: people_model
>
>         ListElement
>         {
>             name: "John Smith"
>             role: "manager"
>             age: 36
>         }
>      ...
>     }
>
> I'd like to have a delegate with a Repeater that accesses the various
> properties of the model in some order:
>
>     Component
>     {
>         id: people_delegate
>         Item
>         {
>             Row
>             {
>                 Repeater
>                 {
>                     Rectangle
>                     {
>                         width: parent.width/3
>                         Text
>                         {
>                             text: <the next property in the model>
>                             color: "white"
>                         }
>                     }
>                 }
>
> It's not clear to me if I can access named properties of the model
> inside a Repeater, however. Is this possible ?
>
> Given that the Repeater doesn't know which model it's working on,
> I can't see how this could be done at present, but it strikes me
> as potentially useful.
>
> --
> Stephen Collyer
>
> _______________________________________________
> Qt-qml mailing list
> Qt-qml at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-qml
>
>




More information about the Qt-qml mailing list