[Interest] Why is this a binding loop?

Jason H jhihn at gmx.com
Wed Nov 16 19:33:01 CET 2016


>
> Well, yeah. I guess there is some ambiguity of childrenRect. I'd figure it's the bounding rect of the union of all the child areas, then offset x,y. So using this reasoning, x,y, might not always be zero, but if childrenRect is including the offset, then the x,y can only ever be zero, and we get a binding loop.
>
> Here's what the docs say:
> """childrenRect group
> childrenRect.x : real
> childrenRect.y : real
> childrenRect.width : real
> childrenRect.height : real
>
> This property holds the collective position and size of the item's children.
> This property is useful if you need to access the collective geometry of an item's children in order to correctly size the item."""
>
> It's probably too late to change it, but I'm wondering if someone can elaborate on why childrenRect.[width|height] includes the offset? It seems that it would be useful to provide a parameter that provides the offset unapplied to the rect.
I'm guessing it's because childrenRect is a QRect, which is a structure that has always contained info about the position (offset) and size (width & height) of a rectangle.
The related data structure that omits the position/offset is QSize.
Perhaps an additional property for Item might be useful? I can't think of a good name for it though. (For consistency and non-ambiguity, the name for such a property should not contain the term "rect

In the "before time" (widgets), we had something called boundingRect, which I think is what the current childrenRect truly is. But childrenRect is behaving like boundingRect of old, and not an actual rectangle of child areas.




More information about the Interest mailing list