18:28:21: Debugging starts
QLayout: Attempting to add QLayout “” to MainWindow “MainWindow”, which already has a layout
问题原因:
If MainWindow is a QMainWindow and you build centralWidget in MainWindow just call setCentralWidget(centralWidget);
You can’t set a layout on a QMainWindow because it already has one that makes all the work for dock widgets etc.
QMainWindow 本身已经有一个layout了,不能再设置layout了。
之所以报错,是因为在QMainWindow中某个成员函数中,使用了:
QGridLayout *t_gridLayout_map = new QGridLayout(this);
改进措施:
QGridLayout *t_gridLayout_map = new QGridLayout();
去掉this之后,OK!!!