在QMainWindow中使用QGridLayout QWidget* widget = new QWidget(mainWindow);widget->setLayout(gridLayout);mainWindow->setCentralWidget(widget);