绑定信号与槽时记得绑定在俩都初始化后。 如:
#include "ccmychardialog.h"
public slots:
void ccmyclose();
emit myclose();
#include "dialog.h"
public slots:
void ccmyclose();
myCCmyCharDialog = new CCmyCharDialog(tcpSocket);
//绑定关闭信号与槽
connect(myCCmyCharDialog,SIGNAL(myclose()),this,SLOT(ccmyclose()));
不然绑定不了报:
QObject::connect: Cannot connect (null)::myclose() to Dialog::ccmyclose()