QStackedWidget居中布局

QStackedWidget* m_pStackedWidget= new QStackedWidget(this);
QWidget* btnWidget = new QWidget;
QWidget* labelWidget = new QWidget;

QVBoxLayout *btnLayout = new QVBoxLayout(btnWidget);
btnLayout->setAlignment(Qt::AlignHCenter);
QVBoxLayout *labelLayout = new QVBoxLayout(labelWidget);
labelLayout->setAlignment(Qt::AlignHCenter);

QPushButton *btn = new QPushButton(this);
QLabel *label= new QLabel(this);

btnLayout->addWidget(btn);
labelLayout->addWidget(label);

m_pStackedWidget->addWidget(btnWidget);
m_pStackedWidget->addWidget(labelWidget);

 

posted @ 2019-05-15 17:26  酷熊  阅读(1412)  评论(1编辑  收藏  举报