QML ListView multiple delegates
Greetings Qt Devs,
I’m using a ListView. Is it possible to specify multiple delegates based on what the model item contains ?
- if my item has a parameter containing “green” I specify a green Rectangle delegate item.
- If my item has a parameter containing “string” I specify a Text delegate item.
Take a look at this: http://cdumez.blogspot.com/2010/11/heterogeneous-list-model-in-qml.html [cdumez.blogspot.com]
I think this is what you are looking for.
From my experience I can assure you that the “loading” condition is by far the better from performance point of view. I had a large delegate that defined all my widgets, and I did exactly as you said….hide/show specific parts. The interface suffered a “hung” effect, and after changing to the “Loader” it worked nicely.
You should try it yourself the both ways and see which one pleases you.