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: 188
Registered: ‎04-07-2013
My Device: BlackBerry Z10
My Carrier: Telus
Accepted Solution

Is private within this context error

[ Edited ]
QObject *listView = root->findChild<ListView*>("listView");
listView->setProperty("dataModel", groupDataModel); //This line returns error: 'QVariant::QVariant(void*)' is private within this context 

 

listView is a ListView declared in QML where groupDataModel is a GroupDataModel declared in C++.

 

Any thoughts on what could have caused the error?? I'm sorry if this question sounds silly, Im just learning QML.
 Thank you

jayvdiyk.com
Highlighted
Developer
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: Is private within this context error

Hi,

 

setProperty expects QVariant, but it couldn't find an appropriate constructor to store QObject in QVariant.

 

You could reference ListView directly instead:

 

ListView *listView = root->findChild<ListView *>("listView");
listView->setDataModel(groupDataModel);

 


Andrey Fidrya, @zmeyc on twitter
Developer
Posts: 188
Registered: ‎04-07-2013
My Device: BlackBerry Z10
My Carrier: Telus

Re: Is private within this context error

Thank you
jayvdiyk.com