widget.h#include "ui_widget.h"#include <QtGui>class Widget : public QWidget, private Ui::Widget{ Q_OBJECT public: explicit Widget(QWidget *parent = 0);};class MainClass: public QWidget, private Ui::Widget{ Q_OBJECTpublic: explicit MainClass(QWidget *parent = 0);};
widget.cpp#include "widget.h"Widget::Widget(QWidget *parent) : QWidget(parent){ setupUi(this); MainClass main;}MainClass::MainClass(QWidget *parent) : QWidget(parent){ setupUi(this); pushButton->setVisible(false); QMessageBox::information(0,"","q");}