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
Regular Contributor
0x29a
Posts: 68
Registered: ‎03-13-2012
My Device: Playbook
My Carrier: Rodgers
Accepted Solution

obtaining items from model in qml and outputing the data?

 onTouch:

        {

           

            for(varx=model.first();x!=model.last();x=model.after(x))

            {

                var item=model.data(x)

                console.log(item.getID)

            }

        }

 

I am trying to obtain the QString from this item object but I am unable to does anyone know how I can obtain the item property values  ?

 

 

Please use plain text.
Regular Contributor
0x29a
Posts: 68
Registered: ‎03-13-2012
My Device: Playbook
My Carrier: Rodgers

Re: obtaining items from model in qml and outputing the data?

IT RETURNS to me 6 undefined items which happens to be the number of items i have in the database query that has been tested in c++ for before and after insertion into the model.

 

 

Please use plain text.
Developer
simon_hain
Posts: 15,874
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: obtaining items from model in qml and outputing the data?

are these custom items? maybe you forgot to use qmlRegisterType to publish them to qml?
----------------------------------------------------------
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
Please use plain text.
Regular Contributor
0x29a
Posts: 68
Registered: ‎03-13-2012
My Device: Playbook
My Carrier: Rodgers

Re: obtaining items from model in qml and outputing the data?

Nah I figured it out I made a mistake with the properties,

 

Q_PROPERTY(QString ID READ getID WRITE setID);

 

The read and write are functions that the qml engine uses to communicate with c++ and act as a wrapper for that ID property.

 

and the c++ property m_ID is independent of Qml so I just replace it with ID instead of getID and it works

Please use plain text.