[Interest] Why is this a binding loop?

Giuseppe D'Angelo giuseppe.dangelo at kdab.com
Wed Nov 16 13:37:39 CET 2016


Il 15/11/2016 23:15, Jason H ha scritto:
> 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?

* The height of the Rectangle depends on the size + the position of the
children

* The position of the Text child depends on the size of the parent,
therefore it depends on the height of the parent

Hence you've got a binding loop.

HTH,
-- 
Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software Engineer
KDAB (UK) Ltd., a KDAB Group company | Tel: UK +44-1625-809908
KDAB - Qt, C++ and OpenGL Experts

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4007 bytes
Desc: Firma crittografica S/MIME
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20161116/28358c2b/attachment.bin>


More information about the Interest mailing list