[haiku-development] Re: BBox and layout

  • From: Clemens <clemens.zeidler@xxxxxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Mon, 07 May 2012 11:48:07 +1200

On Mon, 07 May 2012 10:34:07 +1200, Ingo Weinhold <ingo_weinhold@xxxxxx> wrote:


Alex Wilson wrote:
> My first solution is to just leave the label added to the BBox while
> calling BView::DoLayout and just move it back to the right position
> afterwards. This works fine but why BView::DoLayout layouts the label view > at all? I mean the label is not part of any layout class so it should be
> ignored or what is the policy here?

The reason the label is laid out is because it is a child of the view, and
all children are part of the layout (or a nested layout). [...]

Having worked for a while with Qt now, I'm no longer convinced that implementing the "adding to view adds to layout" automatism was a wise decision. The other way around is obviously useful (and also implemented that way in Qt), but occasionally one does want to manage a child view independently of the layout. A common example is an overlay, though that can generally not be implemented that way in Haiku due to the (unfortunately) missing Z-order between siblings. Anyway, it might be a good idea to remove that automatism before we go beta, since I think it is rarely relied upon (usually one adds children to the layout anyway, particularly when using a layout builder), but annoying when one explicitly doesn't want it.


yes, and in general it is even unknown how to add an item to a layout. For example, there is no mapping from BView::AddChild(BView* child) to BALMLayout::AddView(BView* view, XTab* left, YTab* top, XTab* right, YTab* bottom).

Apart from that it's not very intuitive to me.

Cheers,
        Clemens

Other related posts: