开始学习Qt4编程,记录建立第一个Qt4程序的流程。
1. 编写cpp文件
[root@localhost helloqt]# vim helloqt.cpp
#include <QApplication>
#include <QPushButton>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QPushButton pushButton(QObject::tr("Hello Qt!"));
pushButton.show();
QObject::connect(&pushButton,SIGNAL(clicked()),&app,SLOT(quit()));
return app.exec();
}
2. 生成pro工程文件
[root@localhost helloqt]# qmake -project
3. 生成makefile文件
[root@localhost helloqt]# qmake helloqt.pro
4. 编译
[root@localhost helloqt]# make
5. 执行
[root@localhost helloqt]# ./helloqt
7387

被折叠的 条评论
为什么被折叠?



