Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Highlighted
Developer
Posts: 27
Registered: ‎05-15-2012
My Device: Dev Alpha B
My Carrier: Bell
Accepted Solution

ListViews: ListItemComponents (QML) vs ListItemProvider/Listeners (C++)

Hello,

 

I am developing an application using a list view, which will contain various list item types (one with a single picture, one with lots of text and 3 pictures, etc...)

 

I have beguntaking the road of implementing all in C++ because it did not seem possible leveraging QML as much I I wanted. I have my own DataModel inheriting from the ArrayDataModel class, as well as a ListViewItemFactory inheriting form ListItemProvider and various ListItemListeners. These ListItemListeners contain all the C++ equivalent of the QML code that create a container (containers, layouts, inages, labels, etc...)

 

My question is, can I use my own datamodel and leverage QML for my ListView and its ListItemComponents instead of the ListItemProvider/ListItemListener equivalent in C++? If possible, why would anyone go about creating these in C++?

 

Thanks,

 

Martin

 

 

 

------------------------------------------
Macadamian Technologies Inc.
http://www.macadamian.com/
Developer
Posts: 526
Registered: ‎05-17-2009
My Device: 9900
My Carrier: ATT

Re: ListViews: ListItemComponents (QML) vs ListItemProvider/Listeners (C++)

You can definitely do that in QML by overriding the itemType function in javascript within your ListView. I find this good for simple cases where you dont have many different item types but when you have a bunch of types and the code gets more complex it gets a little cumbersome to do all in the javascript. Especially if you are using custom data. The c++ layer is also slightly faster. You probably wouldnt notice the difference but there is a slight speed increase.
Like all of my posts