[Qt-qml] aliasing property of a delegate in a listview

Thomas Perl th.perl at gmail.com
Mon Dec 6 11:34:42 CET 2010


Hi Bartosh,

2010/12/6 Bartosh Wroblevksy <bartosh at live.com>
> I would like to export the properties of the delegate of a listview to make it more reusable. In other words, I would like to do something like this
>
> ListView {
>     id: listview
>     property alias text: myDelegate.text
>
>     delegate: aCustomDelegate {
>             id:myDelegate
>             text: sometext
>     }
> }

What about something like this instead:

ListView {
    id: yourListview
    property string text

    delegate aCustomDelegate {
        id: myDelegate
        text: yourListview.text
    }
}

Should achieve the same effect as your example (i.e. set "text" from outside).

HTH.

Thomas



More information about the Qt-qml mailing list