08-01-2013 10:32 AM
Is it possible to have multiple ListItemProviders for a single ListView? I need one listview with multiple types of items. If I cannot use multiple ListItemProviders, how would I use a single ListItemProvider to handle varying items??
08-01-2013 01:24 PM
Can you give an example of the sort of data you want? You can customize the actual list item used per type, depending on the data model you are using, meaing each item in the list can look completely different from anything else.
You can't really use separate providers though. What that would mean isn't really well defined.
08-01-2013 01:40 PM
Thanks for the reply,
An example would be a list of events:
First item: Dinner Event, height of 170.0f and background is light blue, shows a title, and up to 3 lines of descriptive text.
Second item: Work Event, height of 200.0f and background is light green, shows a title, short description and an image showing the logo of which department it involves (ex: sales, IT, accounting, all)
Third item: Another work event
Fourth item: Note, height of 100.0f, background is light gray, shows only one line of text.
How would I go about customizing the list item used per type? That seems to be what I'm looking for, just not sure how to do it.
08-01-2013 03:58 PM - edited 08-01-2013 03:59 PM
If you're using QML, assign diferent itemTypes to ListItemComponents. Create one component for dinner type event (itemType: "dinner"), another for work type event (itemType: "work") etc.
If you're declaring the dataModel in C++, overload this function in DataModel subclass and return itemType from it instead:
virtual Q_INVOKABLE QString itemType (const QVariantList &indexPath)