Cruz
20th January 2009, 12:31
I want to add childWidgets to a layouted parentWidget at runtime. I need to construct the children like
ChildWidget* child = new ChildWidget(parentWidget);
right? So now I would expect the child to be layed out according to the parentWidget's layout, but it doesn't happen. It seems like I explicitely have to:
ChildWidget* child = new ChildWidget(parentWidget);
parentWidget->layout()->addWidget(child);
Is this the right way? It feels like I'm adding the child to the parent twice.
ChildWidget* child = new ChildWidget(parentWidget);
right? So now I would expect the child to be layed out according to the parentWidget's layout, but it doesn't happen. It seems like I explicitely have to:
ChildWidget* child = new ChildWidget(parentWidget);
parentWidget->layout()->addWidget(child);
Is this the right way? It feels like I'm adding the child to the parent twice.