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: 696
Registered: ‎12-02-2008
My Device: Not Specified

Accessing List created in QML from C++

Hi,

 

I am trying to create following scenario,

 

A login screen on clicking button on login screen data should be read from file system and this data should be inserted into list and then this list is shown on screen.

 

I had create 2 qmls one for login screen and other containing listview.

 

But i am not able to find way of pushing list from C++.

 

Any information will be helpful.

Regards,
Rajat Gupta.
--------------------------------------------------------------------------------
If your problem was get solved then please mark the thread as "Accepted solution" and kudos - your wish
Contributor
Posts: 10
Registered: ‎03-03-2013
My Device: 8800
My Carrier: viettel

Re: Accessing List created in QML from C++

I think you need to try create to 2 container:
- LoginContainer and ListContainner
On Beginning, set visiable of ListContainer is False, LoginContainer is True. Then Login success, set visiable of ListContainer is True
You can read more document about DataModel https://developer.blackberry.com/native/documentation/cascades/ui/lists/groupdatamodel.html
Developer
Posts: 696
Registered: ‎12-02-2008
My Device: Not Specified

Re: Accessing List created in QML from C++

Hi Maxxmus,

 

Thanks for the reply. But what i want to do is ,

 

1) create a login screen this is created in QML

2) On clicking "Login" button a function in C++ class is called. This function reads the value from filesystem and parses the data. After parsing data i want to assing data to model which will be used in qml containing list.

3) Create a seprate qml for list view which will show data model filled in above point.

 

I had taken help from the below mentioned link to achieve this,

http://supportforums.blackberry.com/t5/Native-Development/Fill-dataModel-with-CustomObjects-and-show...

 

Let me know if you have any better solution as i am new to C++ programming.

Regards,
Rajat Gupta.
--------------------------------------------------------------------------------
If your problem was get solved then please mark the thread as "Accepted solution" and kudos - your wish
Regular Contributor
Posts: 75
Registered: ‎05-31-2013
My Device: 9900
My Carrier: Ufone

Re: Accessing List created in QML from C++

Developer
Posts: 696
Registered: ‎12-02-2008
My Device: Not Specified

Re: Accessing List created in QML from C++

Hi Umair,

 

Thanks for the link, i had read that link.

Regards,
Rajat Gupta.
--------------------------------------------------------------------------------
If your problem was get solved then please mark the thread as "Accepted solution" and kudos - your wish
Regular Contributor
Posts: 75
Registered: ‎05-31-2013
My Device: 9900
My Carrier: Ufone

Re: Accessing List created in QML from C++

what problem you are facing now ?

Developer
Posts: 696
Registered: ‎12-02-2008
My Device: Not Specified

Re: Accessing List created in QML from C++

Hi,

 

No problem no i am able to push qml which contains list from C++ code , below is the code which i am using and it is working fine, just wanted to know is it right way of doing,

 

QmlDocument *otherQml = QmlDocument::create("asset:///list/visitlist.qml");
otherQml->setContextProperty("_login1",this);
Page *page= otherQml->createRootObject<Page>();

ApplicationUI::root->push(page);

 

 

Regards,
Rajat Gupta.
--------------------------------------------------------------------------------
If your problem was get solved then please mark the thread as "Accepted solution" and kudos - your wish
New Developer
Posts: 105
Registered: ‎08-24-2013
My Device: BlackBerry Z10 | BlackBerry Dev Alpha B | BlackBerry PlayBook 32GB | BlackBerry Z10 Limited Edition
My Carrier: Not Provided

Re: Accessing List created in QML from C++

yeah, it looks great !

--
Hit Like if you appreciate this Smiley Happy
Developer
Posts: 696
Registered: ‎12-02-2008
My Device: Not Specified

Re: Accessing List created in QML from C++

Thanks pranay for confirming.

Regards,
Rajat Gupta.
--------------------------------------------------------------------------------
If your problem was get solved then please mark the thread as "Accepted solution" and kudos - your wish