绑定信号与槽时记得绑定在俩都初始化后。
如:
#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()
原文地址:http://blog.51cto.com/haidragon/2093552
时间: 2024-11-06 16:03:20