← Back to team overview

ubuntu-phone team mailing list archive

Can't set value of Label inside

 

I'm trying to set the value of the label in the below code, but the
onCompleted code seems to be unable to reference the label inside the
Component, and the label seems unable to access any property outside the
Component, so I can't see any way to change the text value at runtime.
Any ideas?


AbstractButton {
    width: img_idm109614992.width
    height: img_idm109614992.height
    onClicked: PopupUtils.open(popover_idm109614992, img_idm109614992)
    Component.onCompleted: {
        var fak
        for (var i=0; i < fakojModel.count; ++i) {
            fak = fakojModel.get(i)
            if (fak.code == "LIN") {
                img_idm109614992.source = path + fak.img
                label_idm109614992.text = fak.text  // Reference error
            }
        }
    }

    Image {
        id: img_idm109614992
    }

    Component {
        id: popover_idm109614992
        Popover {
            Label {
                id: label_idm109614992
            }
        }
    }
}

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


Follow ups