[Qt-qml] aliasing property of a delegate in a listview
michael.brasser at nokia.com
michael.brasser at nokia.com
Fri Dec 10 05:56:03 CET 2010
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>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20101210/c2444681/attachment.html
More information about the Qt-qml
mailing list