PDA

View Full Version : Parent-child realtionship



AviMittal
25th June 2009, 14:59
How does anyone know how to create parent-child relationship between two QWiget windows in Qt4.?

Lykurg
25th June 2009, 15:25
QWidget *w1 = new QWidget(0);
QWidget *w2 = new QWidget(w1);
? Now w2 is child of w1.

AviMittal
25th June 2009, 16:03
But in case if i am using Qt designer and say i created two QWiget classes :


Class One:public QWidget
{
};

Class Two:public QWidget
{
};

I such type of implementation how to create paren-child relationship?

Lykurg
25th June 2009, 16:44
Don't understand your case, but in designer you only can create parent child relation if the parent is a container. But in that I'm not sure. Either after you called setupUi() you can create some relation using QWidget::setParent().

And the designer is not an appropriate way to do such things...