Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-13267

Qt Widgets Application template outputs #include <QtGui/QMainWindow> which doesn't compile

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P2: Important P2: Important
    • Qt Creator 3.3.0-rc1
    • Qt Creator 3.3.0-beta1
    • All Other Issues
    • Qt Creator master branch 2adc5c5dc63835644912e403690c230739c27316
      Gentoo Linux amd64
      Windows 7 64 bit
    • d5b4dd65d38796b6c0287ba9c043c41b0435ac81

      "File" > "New File or Project..." > "Application" > "Qt Widgets Application" generates a header file below when the option" C++" > "Qt Class Generation" > "Add Qt Version #ifdef for module names" is unchecked.

      mainwindow.h
      #ifndef MAINWINDOW_H
      #define MAINWINDOW_H
      
      #include <QtGui/QMainWindow>
      
      namespace Ui {
      class MainWindow;
      }
      
      class MainWindow : public QMainWindow
      {
          Q_OBJECT
      
      public:
          explicit MainWindow(QWidget *parent = 0);
          ~MainWindow();
      
      private:
          Ui::MainWindow *ui;
      };
      
      #endif // MAINWINDOW_H
      

      This doesn't compile because QMainWindow belongs QtWidgets module in Qt 5.

      Qt Creator is shipped with Qt 5 now a days, can we change it #include <QtWidgets/QMainWindow> by default?
      or can we simply remove QtGui/ from there?

      https://qt.gitorious.org/qt-creator/qt-creator/source/2adc5c5dc63835644912e403690c230739c27316:src/plugins/designer/qtdesignerformclasscodegenerator.cpp#L131

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            hunger Tobias Hunger
            tasuku.suzuki Tasuku Suzuki
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes