Qt_1——HelloWorld
来源:互联网 发布:百科词条优化 编辑:程序博客网 时间:2024/05/29 08:25
打算从这里开始,记录自己在Qt学习之路上写过的程序。就先从HelloWorld开始吧:)
用Qt Creator新建一个Qt C++ Project→Mobile Qt Application,命名为HelloWorld。
将main.cpp文件代码改为如下:
#include <QtGui/QApplication>
#include <QtGui/QLabel>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QLabel label("Hello,world!");
label.show();
return a.exec();
}
然后运行程序便得到如下图:
关于C++的知识就不赘言了,大家可以翻阅C++相关书籍。
因为这里用到一个QLabel对象,所以开头引入#include <QLabel>。
程序里用到了QApplication和QLabel两个类,而我们需要包含的头文件名和类名是一样的,这非常方便。
而且大家一定也注意到了,Qt的代码真的非常美丽:)
- Qt_1——HelloWorld
- qt_1
- Flex——HelloWorld
- Flex——HelloWorld
- Flex——HelloWorld
- Flex——HelloWorld
- hibernate——helloworld
- struts2——HelloWorld
- UE4——HelloWorld
- aspectJ——helloworld
- SpringData——HelloWorld
- servlet——HelloWorld
- SpringMVC——HelloWorld
- Spring —— HelloWorld
- netty——helloworld
- Dubbo——HelloWorld
- rocketmq——HelloWorld
- helloworld——springmvc
- DateTime ToString
- 排序算法介绍
- SQL的公共表达式(CTE)
- 读书-Java程序员职场全攻略:从小工到专家
- 如何启用SharePoint 2010的代码块
- Qt_1——HelloWorld
- SQL中使用WITH AS提高性能-使用公用表表达式(CTE)简化嵌套SQL
- 生成PDF文件方案--学习中
- XX 项目的验收测试的验收准则 ,其中的验收漏洞
- STL中泛型算法find_if()与sort()的应用举例及详解
- TON/NPI
- ie 火狐半透明
- java.sql.SQLException:Unknown column 'admin' in 'where clause'错误问题
- PE文件资源管理开发小结|以此无聊之作当做2010年最后一件积累