1. 程式人生 > >Qt學習記錄4——mainwindow的佈局使用

Qt學習記錄4——mainwindow的佈局使用

QWidget *centerWindow = new QWidget;
        this->setCentralWidget(centerWindow);
        button = new QPushButton("One");
        button2 = new QPushButton("Two");
        QVBoxLayout *layout = new QVBoxLayout;
        layout->addWidget(button);
        layout->addWidget(button2);
centerWindow->setLayout(layout);