[Interest] Why is this a binding loop?

Elvis Stansvik elvstone at gmail.com
Wed Nov 16 08:41:11 CET 2016


Den 15 nov. 2016 11:15 em skrev "Jason H" <jhihn at gmx.com>:
>
> Rectangle {
>         width: parent.width
>         height: childrenRect.height * 2
>         Text {
>                 text: "title"
>                 anchors.centerIn: parent
>         }
> }
>
> 'QML Rectangle: Binding loop detected for property "height"'
>
> I think that computation should be possible without creating a binding
loop?

I would think so too, but perhaps there's a limitation such that when you
use childrenRect in the height expression, a dependency on that property
group as a whole (including x and y, which are in turn dependent on the
parent height, thus creating a "false" loop) is introduced.

Though I don't know, that seems like a serious limitation to me, so I'm
probably wrong. Just an idea.

Does it work if you give the Text an id, and use the Text's height
explicitly instead of childrenRect.height? (on the bus, so can't test).

Elvis

> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20161116/a869b900/attachment.html>


More information about the Interest mailing list