QWidget *w=new QWidget;
QHBoxLayout *mainLayout=new QHBoxLayout;
QListWidget *listwidget=new QListWidget(w);
listwidget->addItem(QStringLiteral("第一个界面"));
listwidget->addItem(QStringLiteral("第二个界面"));
QWidget *page1 = new QWidget(w);
QWidget *page2 = new QWidget(w);
QLabel *label1=new QLabel(page1);
QLabel *label2=new QLabel(page2);
label1->setText(QStringLiteral("第一个界面"));
label2->setText(QStringLiteral("第二个界面"));
QVBoxLayout *leftLayout=new QVBoxLayout;
leftLayout->addWidget(listwidget);
QStackedLayout *rightLayout=new QStackedLayout;
rightLayout->addWidget(page1);
rightLayout->addWidget(page2);
mainLayout->addLayout(leftLayout);
mainLayout->addLayout(rightLayout);
w->setLayout(mainLayout);
listwidget->setCurrentRow(0);
connect(listwidget,SIGNAL(currentRowChanged(int)),rightLayout,SLOT(setCurrentIndex(int)));
w->show();