← Back to team overview

ubuntu-phone team mailing list archive

Array push not functioning

 

Can anybody understand what is happening with my code. It is a bit of
Javascript embedded in my QML:

        print(componentList.push(Qt.createQmlObject("import
        Ubuntu.Components 0.1; Label {text: '" + node.nodeValue.trim() +
        "'}", col, "myLabel")))
        print("BAR", componentList.length)

This output from this is:
        1
        BAR 0

This says that push has succeeded and the array is now of length 1, then
on the next line, the length is 0.

The array is defined as a property further up in an outer object:

        property variant componentList: new Array() // Or []

I need to be able to destroy the components I create dynamically, but it
seems I'm unable to store a reference to them.

Attachment: signature.asc
Description: This is a digitally signed message part


Follow ups