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

Posts: 16,894
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Cannot access list on an object from a slot

I have a slot in QML where i receive several QObjects, one of them is DataServicePage.

This object has a QList<DataServiceBox*> as well as a QString id.

To access both from QML i use Q_PROPERTY:


Q_PROPERTY(QString id READ getPageId)
Q_PROPERTY(QDeclarativeListProperty<DataServiceBox> boxes READ getDataServiceBoxesQml)

In QML i can access the id property successfully and get the value of the QString.

However, when i try to access the boxes property i get this (created by:  console.log("page boxes: " + page.boxes) ):

page boxes: QVariant(QDeclarativeListProperty<DataServiceBox>)

when i try to access the length attribute i just get "undefined" though.


I use this construct successfully when i access the base object (that contains the list) from a context property, but the exact same code does not work when the base object comes in a slot.

When it works (in the other cases) i get a different console output, just [object Object] instead of QVariant


Is it possible that the slot mechanism somehow does not work with the list property?

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