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
New Developer
Posts: 92
Registered: ‎01-23-2009
My Device: Z10
My Carrier: klarmobil
Accepted Solution

How to declare your custom data type used in your QListDataModel to QML?

I have QListDataModel filled with objects of a custom class carying the data and defined with Q_DECLARE_METATYPE. So far it works however I can't access the data in qml:

 

e.g. text: ListItemData.Name 

 I have read this can be solved by letting QML know about your custom class/type but how to do this?

Developer
Posts: 17,012
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: How to declare your custom data type used in your QListDataModel to QML?

see

https://developer.blackberry.com/native/documentation/cascades/dev/integrating_cpp_qml/

 

example:

qmlRegisterType<Account>("com.isec7.materials", 1, 0, "Account");

 

----------------------------------------------------------
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
New Developer
Posts: 92
Registered: ‎01-23-2009
My Device: Z10
My Carrier: klarmobil

Re: How to declare your custom data type used in your QListDataModel to QML?

Thanks, looks like what I was looking for.