Qt:Attempting to add QLayout to MainWindow , which already has a layout

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 了

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章