Search code examples
qtqcoreapplication

QCoreApplication::exit() from non-GUI subproject


Consider this case: there is a SUBDIRS Qt project which includes GUI subproject, which uses "gui" Qt module, and non-GUI subproject which is a dynamic library used by the GUI subproject, which uses only "core" Qt module. Is it correct to call QCoreApplication::exit() from the non-GUI subproject?


Solution

  • Converting my comment into this answer:

    QApplication inherits from QCoreApplication. Since exit() is not a virtual function, you can call it from the non-GUI code.