setLayout: Attempting to set QLayout "" on MainWindow "MainWindow", which already has a layout
如题,出现这个的原因是,如果你的窗口继承的是QMainwindow,需要设置setCentralWidget();如下:
QWidget*widget=newQWidget(mainWindow);
widget->setLayout(yourMainLayout);
mainWindow->setCentralWidget(widget);
设置好一个widget,将其加