[Qt-qml] Flickable with dynamically growing children
michael.brasser at nokia.com
michael.brasser at nokia.com
Mon Mar 21 07:35:53 CET 2011
Hi Bo,
On 18/03/2011, at 8:28 PM, ext Bo Elmgreen wrote:
I have been playing around with the following example:
http://wiki.forum.nokia.com/index.php/How_to_create_a_Collapsible_Panel_with_QML
I would like to have a list with two collapsible groups, but instead of each group being flickable, as in the example, I would like the combined list to be flickable.
So, I have embedded my two collapsible panels in a Flickable item and set their interactive properties to false. This works ok as long as I have a static elements in the two lists or if they are loaded from a file. But now I receive the elements over a network connection one by one, and then I have problems with setting the height - both of the two lists and of the content of the surrounding flickable :-/ Now I give the Flickable's contentHeight a default value as well as the two collapsible panels, and then I try to update their height dynamically by reacting on ListView.onAdd in their ListViews:
ListView{
id: listView
width: parent.width
height: parent.height-titleRect.height
anchors.top: titleRect.bottom
interactive: false
model: customModel
delegate: customDelegate
ListView.onAdd: { myRect.setHeight(60); console.log("listview on add") }
}
The ListView.onAdd handler needs to be placed inside the delegate to work correctly (we'll need to improve the documentation for this). Unless there is an explicit setHeight() function, you may also need to change the assignment to myRect.height = 60.
Regards,
Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20110321/0cb1301c/attachment.html
More information about the Qt-qml
mailing list