在网上抄了使用UI的几段代码.发现运行不起来.代码如下,请大神帮忙看一下问题,不胜感激
UI文件的名称是 RegDialog.ui
main.cpp:
- C/C++ code
#include <QApplication>#include "RegDlalog.h"int main(int argc, char *argv[]){ QApplication app(argc, argv); RegDlalog *dialog = new RegDlalog; dialog->show(); return app.exec();}
RegDialog.h:
- C/C++ code
#ifndef REGDLALOG_H#define REGDLALOG_H#include <QDialog>#include <QWidget>#include "ui_RegDialog.h"namespace Ui{ class RegDialog;}class RegDialog : public QWidget{ Q_OBJECTpublic: RegDialog(QWidget *parent = 0); ~RegDialog();private: Ui::RegDialog *ui;};#endif // REGDLALOG_H
RegDialog.cpp
- C/C++ code
#include <QtGui>#include "RegDlalog.h"#include "ui_RegDialog.h"RegDialog::RegDialog(QWidget *parent) : QWidget(this), ui(new Ui::RegDialog){ ui->setupUi(this);}RegDialog::~RegDialog(){ delete ui;}
------解决方案--------------------
QT学习