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

QCoreApplication::Type vs. QApplication::type()

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.0.0 RC 1
    • 5.0.0 Beta 2
    • Core: Other
    • None
    • 553e216d891177ee0c2cea70bbd7f21103fc7795

    Description

      Wouldn't it make sense to make the QCoreApplication::Type enumeration reflect the available application types in Qt 5, and propagate the getter from QApplication::type() to QCoreApplication::type()?

      enum Type {
          Tty,
          GuiClient,
          GuiServer // # deprecated
      };
      

      It could offer values like Tty(or even simply Core?),Gui,Widgets instead.

      It is very confusing that currently QApplication::type() returns Tty when QGuiApplication was instantiated. As a side effect, instantiating QWidget in a GUI application throws a misleading fatal error:

      #include <QtWidgets>
      int main( int argc, char* argv[])
      {
          QGuiApplication a(argc,argv);
          QWidget w; // QWidget: Cannot create a QWidget when no GUI is being used
          w.show();
          return a.exec();
      }
      

      Attachments

        Issue Links

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

          Activity

            People

              Unassigned Unassigned
              jpnurmi J-P Nurmi
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes