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
Developer
ankur_siwach
Posts: 148
Registered: ‎09-28-2012
My Device: Blackberry Developer

how to get data in qml from the class

hello,

 

i have a QList<QString> which have some data , i need to access the data of QList into ListView,

 

so that i can make my ListView dynamic..

 

Thanx.. :smileyhappy:


----------------------------------------------------------
Feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
Retired
PBernhardt
Posts: 749
Registered: ‎12-16-2008
My Device: BlackBerry Z30

Re: how to get data in qml from the class

You may want to take a look at the ArrayDataModel, or perhaps a GroupDataModel

 

https://developer.blackberry.com/native/reference/cascades/bb__cascades__arraydatamodel.html?f=datam...

Paul Bernhardt
Application Development Consultant
BlackBerry
@PBernhardt

Did this answer your question? Please accept this post as the solution.
Found a bug? Report it to the Developer Issue Tracker
Developer
simon_hain
Posts: 16,282
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: how to get data in qml from the class

there is a concept to male a qlist accessible as a property (qdeclarativelistproperty), but it requires some overhead and did not work good for me.
I usually provide an own class for the list and give it accessors with Q_INVOKABLE size() and elementAt(index) functions.

for example:
a class User has a list of UserContent objects.
I create a new class called UserContents which contains this list and also provides the size, elements etc as Q_INVOKABLE.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
ankur_siwach
Posts: 148
Registered: ‎09-28-2012
My Device: Blackberry Developer

Re: how to get data in qml from the class

thanx guys..

 

let me try..


----------------------------------------------------------
Feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.