QT的第一个程序HELLO WORLD
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()
{
}
總結
以上是生活随笔為你收集整理的QT的第一个程序HELLO WORLD的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 使用SVCUtil.exe生成客户端代理
- 下一篇: tar方式安装oracle11g