qt中递归的对框架所有子对象进行connect

先看Qt Assistant中对connectSlotsByName 函数的说明:
void QMetaObject::connectSlotsByName ( QObject * object )  [static]
Searches recursively for all child objects of the given object, and connects matching signals from them to slots of object that follow the following form:
  void on_<widget name>_<signal name>(<signal parameters>);  //响应槽的函数原型
Let's assume our object has a child object of type QPushButton with the object name button1.
The slot to catch the button's clicked() signal would be:
 void on_button1_clicked();
该函数在界面开发工具(Qt Designer或者vs2005)中,自动的在setupUi()函数中调用,使得所编辑的GUI的内部挂件自动的connect信号和相应的函数。但是要 注意不要忘记在包含该框架的类中定义槽void on_<widget name>_<signal name>(<signal parameters>); 

你可能感兴趣的:(框架,object,Parameters,qt,button,Signal)