Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.5.3
-
None
-
6809bd020e3307324e136707f32f6f17f77b9591
Description
When compiling a basic application that uses a form describing a QMainWindow with the central widget promoted to a custom class, uic omits the rather important line: MainWindow->setCentralWidget(centralWidget);
void setupUi(QMainWindow *MainWindow)
{
if (MainWindow->objectName().isEmpty())
MainWindow->setObjectName(QString::fromUtf8("MainWindow"));
MainWindow->resize(502, 364);
centralWidget = new Renderer(MainWindow); // Renderer is the custom class derived from QGLWidget
centralWidget->setObjectName(QString::fromUtf8("centralWidget"));
////--> MainWindow>setCentralWidget(centralWidget); <---//// This line is missing in the ui_mainwindow.h output file
menuBar = new QMenuBar(MainWindow);
menuBar->setObjectName(QString::fromUtf8("menuBar"));
menuBar->setGeometry(QRect(0, 0, 502, 25));
MainWindow->setMenuBar(menuBar);
statusBar = new QStatusBar(MainWindow);
statusBar->setObjectName(QString::fromUtf8("statusBar"));
MainWindow->setStatusBar(statusBar);
If the central widget is demoted back to a QWidget, the missing line reappears.