QWidget *parentw = new QWidget(); QWidget *child1 = new QWidget(); QListWidget *b1 = new QListWidget(); QListWidget *b2 = new QListWidget(); QHBoxLayout *hl = new QHBoxLayout(); hl->addWidget(b1); hl->addWidget(b2); child1->setLayout(hl); child1->show(); QWidget *child2 = new QWidget(parentw); QPushButton *b3 = new QPushButton( "b3" ); QPushButton *b4 = new QPushButton( "b4" ); QVBoxLayout *vl = new QVBoxLayout(child2); vl->addWidget(b3,0,Qt::AlignHCenter); vl->addWidget(b4,0,Qt::AlignHCenter); child2->setLayout(vl); QStackedLayout *sl = new QStackedLayout(); sl->addWidget(child1); sl->addWidget(child2); sl->setStackingMode(QStackedLayout::StackAll); parentw->setLayout(sl); sl->setCurrentWidget(child2); parentw->show();