Am 10.05.2012 00:07, schrieb Clemens:
As a backup for this hypothesis I can only point back to the stunning simple qt QGroupBox example. I looked into the QGroupBox source and zero magic is going on there! just the use of the standard api no need for QGroupBoxLayout :-)
In Qt, don't you have to specify the parent widget when you create a widget? In the Be API, you don't, and that's why you have to use AddChild().
I don't understand why the current auto-add behaviour prevents this. Unless you are also planning to remove the guarantee that a BView with a BLayoutItem in a BLayout will be a child of the BLayout's target BView. I guess that would be doable, but it would mean that you'd need to add every view to both the BView and the BLayout, which would be a huge pain.ok an example use case is that you have two different BLayouts fLayout1 and fLayout2 holding the same views. fLayout1 is child of another parent layout which is attached to a target view. Thus all child items of fLayout1 are attached to the target view. fLayout2 is not attached to any view. Now you want to switch between both layouts for some reason. That can be done by doing: parent->RemoveItem(fLayout1); parent->AddItem(fLayout2, ...); This removes fLayout1 and all views from the target view and adds fLayout2 and all child views again. You can also switch it back: parent->RemoveItem(fLayout2); parent->AddItem(fLayout1, ...); So only if the layout is attached to a target also the child items are guaranteed to be attached to the same target view.
So what is your proposed solution that you have to call AddChild() to add the views to the parent in the first place? In the current solution, you don't have to do that and I find your proposed change would add a lot of overhead to the common case, while it enables a corner case that could also be solved by other means.
Best regards, -Stephan