在Qt的主窗口(MainWindow)中使用setLayout()函数时,运行时即会报如题所示的错误,这是什么原因呢,我使用“F1”瞅了瞅QMainWindow,发现了如下信息:
A main window provides a framework for building an application's user interface. Qt has QMainWindow and its related classes for main window management. QMainWindow has its own layout to which you can add QToolBars, QDockWidgets, a QMenuBar, and a QStatusBar. The layout has a center area that can be occupied by any kind of widget. You can see an image of the layout below.
大概意思就是说mainwindow的主框架里已经有了一个Layout了,这个Layout包括了菜单栏、工具栏、停驻窗口区、中心窗口区、底部状态栏五部分,对于dev们应该够用了,但是如果实在是要再使用Layout