12-05-2012 11:52 AM
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?