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

New Contributor
Posts: 9
Registered: ‎09-10-2012
My Device: BlackBerry 9300
My Carrier: T-mobile poland

How to get object from GroupDataModel


I read tutorial https://developer.blackberry.com/cascades/documentation/ui/lists/groupdatamodel.html  especially section "Creating a GroupDataModel in both QML and C++"


So I use bb::cascades::GroupDataModel* mModel. 


I insert MainListItem to data model:


MainListItem* item = new MainListItem(title, count, icon);



My question is:

How can I get MainListItem from mModel which response triggered item in function?

void MainListPage::onTriggeredList( QVariantList indexPath)



I tried 


void MainListPage::onTriggeredList( QVariantList indexPath)
QVariant mainListItem = mModel->data(indexPath); MainListItem* object = (MainListItem*)mainListItem.data();



but variable object  isn't correct MainListItem






Posts: 329
Registered: ‎05-07-2012
My Device: BB Alpha
My Carrier: N/A

Re: How to get object from GroupDataModel

Hi there,


Welcome to the forums!


We have a few knowledge base articles on this subject - have you taken a look at them? They can be found here: