Qt:Attempting to add QLayout “” to MainWindow “”, which already has a layout
意思是,试图添加一个布局到mainwindow上,但实际上该布局已经存在了。
我原来的代码:
QVBoxLayout *layoutt = new QVBoxLayout(this);
现在改为:
QVBoxLayout *layoutt = new QVBoxLayout(ui->show_widget);
**总结:**布局layout的父窗体 要具体指定,如果指定为this就是当前窗体,但我想在固定的窗体上添加,就不能是this 了