16,215
社区成员
发帖
与我相关
我的任务
分享
#include "dialog.h"
#include <QDebug>
Dialog::Dialog(QWidget *parent)
: QDialog(parent)
{
connect(this,SIGNAL(s1()),this,SLOT(fun1()));
connect(this,SIGNAL(s2()),this,SLOT(fun2()));
emit s1();
qDebug()<<"构造函数离开";
}
Dialog::~Dialog()
{
}
void Dialog::fun1()
{
qDebug()<<"函数1进入";
emit s2();
qDebug()<<"函数1离开";
}
void Dialog::fun2()
{
qDebug()<<"函数2进入";
}
结果:
函数1进入
函数2进入
函数1离开
构造函数离开