来自非GUI子项目的QCoreApplication :: exit()

时间:2022-11-09 20:13:19

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?

考虑这种情况:有一个SUBDIRS Qt项目,其中包括GUI子项目,它使用“gui”Qt模块,以及非GUI子项目,它是GUI子项目使用的动态库,仅使用“核心”Qt模块。从非GUI子项目调用QCoreApplication :: exit()是否正确?

1 个解决方案

#1


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.

QApplication继承自QCoreApplication。由于exit()不是虚函数,因此可以从非GUI代码调用它。

#1


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.

QApplication继承自QCoreApplication。由于exit()不是虚函数,因此可以从非GUI代码调用它。