Hi,

The ListView's delegate is really just a template for the list items that will 
be shown in the view (as Girish pointed out in an earlier thread, delegate: 
aCustomDelegate {} is really just shorthand for delegate: Component { 
aCustomDelegate {} }), which is why you cannot create an alias to it (it will 
be instantiated many times). Are you looking for access to the data of the 
currently selected item in the view (i.e. the ListView's currentItem)? You 
could try something like the following if you don't need true aliasing:

 ListView {
    id: listview
    property string text: listview.currentItem ? listview.currentItem.text : ""
    delegate: Text {
            id: myDelegate
            text: sometext
    }
}

Regards,
Michael

On 06/12/2010, at 10:13 AM, ext Bartosh Wroblevksy wrote:

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

    }

}


Is it possible?


Thanks,
Bartosh


<ATT00001..txt>

_______________________________________________
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml

Reply via email to