ubuntu-phone team mailing list archive
-
ubuntu-phone team
-
Mailing list archive
-
Message #09148
Re: Can't set value of Label inside
On Wednesday 23 July 2014 12:54:10 Sam Bull wrote:
> On mer, 2014-07-23 at 13:47 +0200, Michael Zanetti wrote:
> > a) By the time Component.onCompleted is called. the PopupUtils.open()
> > hasn't been called yet. So the popover doesn't exist
>
> Ah, didn't realise the inner component wasn't even constructed until
> PopupUtils.open().
>
> > Solution: create a property somewhere (outside the Popover Component),
> > like
>
> > this:
> Unfortunately, this is what I was hinting at when I said the label is
> unable to access anything outside the component. I tried exactly this,
> and the label was unable to reference any property outside of the
> popover.
uhm... really? I didn't try it right now, but I'm quite positive I did that
before...
Well, there's always the possibility to pass the value as a parameter, like
this:
Component {
id: popoverComponent
Popover {
id: popover
property string text
Label {
id: label_idm109614992
text: popover.text
}
}
}
and open it with:
PopupUtils.open(popoverComponent, parent, {text: "foobar"})
Br,
Michael
References