Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-5824

uic omits critical line in promoted central widgets

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 4.6.1
    • 4.5.3
    • Tools: Designer
    • 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.

      Attachments

        1. mainwindow.ui
          0.9 kB
        2. ui_mainwindow.h
          2 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kleint Friedemann Kleint
            munk Nolan Martin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes