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 Contributor
codespy
Posts: 9
Registered: ‎09-10-2012
My Device: BlackBerry 9300

How to get object from GroupDataModel

Hi

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);
mModel->insert(item);

 

 

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

 

 

 

 

 

BlackBerry Development Advisor (Retired)
mgoulet
Posts: 329
Registered: ‎05-07-2012
My Device: BB Alpha

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:

http://supportforums.blackberry.com/t5/Cascades-Development-Knowledge/tkb-p/Cascades%40tkb

 

Cheers,

 

Martin