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
Posts: 151
Registered: ‎09-28-2012
My Device: Blackberry Developer
My Carrier: Aircel

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.. Smiley Happy


----------------------------------------------------------
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.
Highlighted
Retired
Posts: 749
Registered: ‎12-16-2008
My Device: BlackBerry Z30
My Carrier: Bell

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
Posts: 16,986
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

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
Posts: 151
Registered: ‎09-28-2012
My Device: Blackberry Developer
My Carrier: Aircel

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.