Qt5 QApplication类---基本用法

                                                       留得青山在, 不怕没柴烧


qt5.12官方文档: https://doc.qt.io/qt-5/qapplication.html#details ,文档上讲解的比较全面。 下面几个地方需要注意:

1)qApp

A global pointer referring to the unique application object. It is equivalent to QCoreApplication::instance(), but cast as a QApplication pointer, so only valid when the unique application object is a QApplication.

另外:The QApplication object is accessible through the instance() function that returns a pointer equivalent to the global qApp pointer.

2)整个程序中只能有一个QApplication对象!如果程序不是基于Qwideget控件,应该使用QGuiApplication。:

“For any GUI application using Qt, there is precisely one QApplication object, no matter whether the application has 0, 1, 2 or more windows at any given time. For non-QWidget based Qt applications, use QGuiApplication instead, as it does not depend on the

你可能感兴趣的:(QT)