QML ListView with variable Item heights
so i am trying to build a ListView like the Facebook timeline.
The Items in the ListView should have a variable Item height.
Is there a way to do this?
Right now i am using a Column with an Repeater inside but this got a huge performace problem to show more than 50 Objects. ( it gets choppy/slow @ scrolling)
Hi! You need to define your own delegate. See http://doc.qt.io/qt-5/qml-qtquick-listview.html#delegate-prop
My delegate looks like this :
height: text.height + 40px
text: "some random text, but the text can have up to 10 rows so the height is not fix"
So the ListView can handle Items with a variable height? I thought the ListView needs items with fixed Heights? Or am I wrong?
So the ListView can handle Items with a variable height?
Yes, no problem. Take a look at this image: https://drive.google.com/file/d/0B2D1UtsPfTx-aGR4TmxVLWNUX3M/view?usp=sharing. On the left side is a ListView. It has items with a small hight (the ones with black background) and items with variable hight depending on the amount of text they contain. (In this image these text items all have the same hight only because they all contain the same dummy text.)