还是要学一下Qt的
时间:2009-05-25 来源:zhengwenwei_123
connect() is perhaps the most central feature of Qt. Note that connect() is a static function in QObject. Do not confuse it with the connect() function in the socket library. This line establishes a one-way connection between two Qt objects (objects that inherit QObject, directly or indirectly). Every Qt object can have both signals (to send messages) and slots (to receive messages). All widgets are Qt objects. They inherit QWidget which in turn inherits QObject. Here, the clicked() signal of quit is connected to the quit() slot of a, so that when the button is clicked, the application quits.
Chapter 3: Family Values
#include <qapplication.h> |
注意到在MyWidget的构造函数里,quit的实例是有Qt管理,在生命周期结束时释放。所以这里没有析构函数。(你也可以手动添加析构函数来释放它)