This should all just work automatically.  As you add items to the model and/or 
change the height of delegates, the contentHeight of the ListView will be 
updated accordingly.

You can only use ListView.onAdd in a delegate.

It would be helpful to see a working example.

Br,
Martin.

From: [email protected] 
[mailto:[email protected]] On Behalf Of ext Bo 
Elmgreen
Sent: Friday, 18 March 2011 8:29 PM
To: [email protected]
Subject: [Qt-qml] Flickable with dynamically growing children

Hi all,

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") }

    }

- but it doesn't seem to be called... so their heights remain fixed.

So, I was wondering if there was a "standard way" of handling this?

Thanks,
Bo
_______________________________________________
Qt-qml mailing list
[email protected]
http://lists.qt.nokia.com/mailman/listinfo/qt-qml

Reply via email to