孤独的猫

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

1.打开VS2010新建一个QT的dialog类型程序

2.将框架生成的main.cpp代码修改如下:

#include "qthelloworld.h"
#include <QApplication>

int main(int argc, char *argv[])
{
 QApplication a(argc, argv);
 QTHelloworld w;
 w.show();
 return a.exec();
}

3.qthelloworld.h文件:

#ifndef QTHELLOWORLD_H
#define QTHELLOWORLD_H

#include <QApplication>
#include <QtGUI>

class QTHelloworld : public QMainWindow
{
 Q_OBJECT

public:
 QTHelloworld(QWidget *parent = 0, Qt::WFlags flags = 0);
 ~QTHelloworld();

private:
 Ui::QTHelloworldClass ui;
};

#endif // QTHELLOWORLD_H

4.qthelloworld.cpp文件:

#include "qthelloworld.h"

QTHelloworld::QTHelloworld(QWidget *parent, Qt::WFlags flags)
 : QMainWindow(parent, flags)
{
 ui.setupUi(this);
}

QTHelloworld::~QTHelloworld()
{

}

posted on 2011-04-08 20:06  孤独的猫  阅读(292)  评论(0编辑  收藏  举报