#include "exp.h" #include<QString> exp::exp(QWidget *parent, Qt::WFlags flags) : QMainWindow(parent, flags) { ui.setupUi(this); connect(ui.pushButton,SIGNAL(clicked()),this,SLOT(on_pushButton_clicked())); }
当然还需要在.h里声明信号。
#include "exp.h" #include<QString> exp::exp(QWidget *parent, Qt::WFlags flags) : QMainWindow(parent, flags) { ui.setupUi(this); connect(ui.pushButton,SIGNAL(clicked()),this,SLOT(on_pushButton_clicked())); }
当然还需要在.h里声明信号。