Header: #ifndef _NEWFORM_H #define _NEWFORM_H #include "ui_newForm.h" class newForm : public QMainWindow { Q_OBJECT public: newForm(); virtual ~newForm(); void test(); private: Ui::newForm widget; private slots: void on_pushButton_clicked(); }; #endif /* _NEWFORM_H */ cpp: #include #include "newForm.h" newForm::newForm() { //QWidget(parent); QMetaObject::connectSlotsByName(this); widget.setupUi(this); //connect( , SIGNAL(clicked()),this, SLOT(test())); } void newForm::on_pushButton_clicked() { std::cout << "penis\n"; } newForm::~newForm() { }