Important: Please read the Qt Code of Conduct -

differences between QApplication, QGuiAppication, QCoreApplication classes

  • Hi all,
    I came across three classes QApplication ,QGuiAppication ,QCoreApplication .as per Qt document these are the classes which are used for event loop(what is event loop ?) .but i am not getting in which exact scenario i need to use any of these classes?.what are the differences between them ?.what are the significances of these classes?

  • Moderators

    • QCoreApplication - base class. Use it in command line applications.
    • QGuiApplication - base class + GUI capabilities. Use it in QML applications.
    • QApplication - base class + GUI + support for widgets. Use it in QtWidgets applications.

    Event loop - well here I recommend reading through the documentation + some Qt book. But in short: event loop is an infinite loop that works in the background of your application and handles events incoming from your operating system (mouse move, clicks, paint events, hardware events etc.), as well as internal communication (signals and slots). The event loop starts when you call app.exec();.

  • thanks !!!

Log in to reply