Custom Elements on ListView
Hello, I'm new to QML and I'm having some problems with listView, hope someone can help me.
I'm trying to implement a list where the last element is different from the others so I can't use delegates as they define a common interface for all items.
One test that I did was to change expanding delegates example to create a Flickable element and add the list and a rectangle on it but the best that I got was a rectangle over the list...
In my application I'm trying to create a tweet list and the last element is a "More" button where the user can click to download more tweets.
One approach using Delegates could be to create an item which holds two items... one of which is your tweet and the other is your "More" button.
Test to see if index is equal to the number of elements minus 1, if so then set the More button's visible=true and the tweet's visible to false... vice-versa if index is less than that.
Hope that makes sense!
Agreed. That should work nicely. If your items are very large and complex then you may also like to take a look at the Loader item which loads items as needed. That way you only get the actual item you want for each cell in your list rather than both but with one being hidden.
It sounds like a footer is what you're looking for.
Cool. You learn something new everyday. Thanks Reffy I can make use of that myself ;-)
Yep good one Reffy.
Reffy, I can't believe that I didn't see that on the documentation!
Thanks everyone for the ideas, I'll be using this footer prop.