点next 之后, 输入lHelloWorld 作为工程名字, 如下图:

<!-- @page { margin: 2cm } P { margin-bottom: 0.21cm } -->
你可以直接点Finish 结束. 也可以点Next 看看QT 为你生成了什么:

<!-- @page { margin: 2cm } P { margin-bottom: 0.21cm } -->
我们不需对预定义的设置作改动. 直接点Finish 即可. 结束工程配置之后, 你会看到QT 为你生成了许多文件:

<!-- @page { margin: 2cm } P { margin-bottom: 0.21cm } -->
双击helloworld.ui 文件, 拖动一个push button 和 一个label 对象到helloworld.ui 上. 并且设置 push button 的 Object name 属性为 helloButton,text 属性为”Click me”, label 的Object name 为 helloLabel, text 属性为”Hello,QT!” 如下图:

<!-- @page { margin: 2cm } P { margin-bottom: 0.21cm } -->
现在, 我们想在单击button 的时候改变label 显示的文字. 如果用VB/Delphi/ 浏览器里常用的事件术语来描述我们的需求的话, 需求如下:
1 单击button 的时候, 发生一个button 的click 事件.
2 必须编写一个事件处理函数, 在button 的onclick 发生后, 处理该事件.
3 这个事件处理函数的内容很简单. 改变label 的text 值即可.
很显然, 我们只需要关注3, 即如何添加事件处理函数即可.
打开helloworld.h, 添加如下代码:
private slots:
void on_helloButton_clicked ();
<!-- @page { margin: 2cm } P { margin-bottom: 0.21cm } -->
打开helloworld.cpp 添加如下代码:
void HelloWorld::on_helloButton_clicked (){
ui . helloLabel -> setText ( "Great!Your first Qt application works fine!" );
}
最后,这两个文件的代码如下所示:
helloworld.h
#define HELLOWORLD_H
#include < QtGui / QWidget >
#include " ui_helloworld.h "
class HelloWorld : public QWidget
{
Q_OBJECT
public :
HelloWorld(QWidget * parent = 0 );
~ HelloWorld();
private :
Ui::HelloWorldClass ui;
private slots:
void on_helloButton_clicked();
};
#endif // HELLOWORLD_H
helloworld.cpp
HelloWorld::HelloWorld(QWidget * parent)
: QWidget(parent)
{
ui.setupUi( this );
}
HelloWorld:: ~ HelloWorld()
{
}
void HelloWorld::on_helloButton_clicked(){
ui.helloLabel -> setText( " Great!Your first Qt application works fine! " );
}
<!-- @page { margin: 2cm } P { margin-bottom: 0.21cm } -->
快捷键 ctrl+b 编译工程 . 然后打开 Eclipse->Run->Run configurations, 配置如下

<!-- @page { margin: 2cm } P { margin-bottom: 0.21cm } -->
然后点击run, 你第一个Qt 程序就跑起来了.

<!-- @page { margin: 2cm } P { margin-bottom: 0.21cm } -->
伟大的<C programming language> 里说过, 学一门语言, 只要你懂得如何写程序, 编译, 运行, 那么学习这门语言将不再是难事. 本文介绍了在Eclipse 里基本的Qt 开发流程, 希望对大家有帮助.