C++ (Qt)#include "ui_myform.h"#include <QWidget> class MyWidget: public QWidget, private Ui::MyWidget{...public: MyWidget(QWidget *parent = 0) :QWidget(parent) { setupUi(this); }};
C++ (Qt)#include "ui_myform.h"#include <QWidget> class MyWidget: public QWidget{...public: MyWidget(QWidget *parent = 0) :QWidget(parent) { m_ui.setupUi(this); } private: Ui::MyWidget m_ui;};
C++ (Qt)#include <QWidget> namespace Ui { class MyForm;} class MyWidget: public QWidget{...public: MyWidget(QWidget *parent = 0); ~MyWidget(); private: Ui::MyWidget *m_ui;};cpp-file[code=cpp]#include "myform.h"#include "ui_myform.h" MyWidget::MyWidget(QWidget *parent) :QWidget(parent), m_ui(new Ui::MyForm()){ m_ui->setupUi(this);} MyWidget::~MyWidget(){ delete m_ui; m_ui = 0;}
А попробуйте без креатора обоитись..
#include <QApplication>#include <QDialog>#include "ui_gotocelldialog.h"int main(int argc, char *argv[]){ QApplication app(argc, argv); Ui::GoToCellDialog ui; QDialog *dialog = new QDialog; ui.setupUi(dialog); dialog->show(); return app.exec();}
TEMPLATE = app FORMS = gotocelldialog.ui SOURCES = main.cpp