您的位置:首页 > 编程语言 > Qt开发

QT helloworld

2016-08-10 20:38 465 查看

1.linux 下安装qt

使用ubantu software center 查找qt-creator自动安装。

2.不使用设计器实现qt-helloworld(使用代码生成窗口类)##

在qt-creator中按照以下选项新建空的工程:

file->new file/project->other project->Empty Qt Project

qt-helloworld主要步骤如下:

1.包含头文件

2.创建管理应用程序的资源的QApplication

3.新建QMainWindow窗口对象

4.显示窗口

5.返回

#include<QApplication>
#include <QMainWindow>
int main(int argc,char* argv[])
{
//创建一个QApplication 对象,管理应用程序的资源
QApplication* qa=new QApplication(argc,argv);
//新建一默认窗口类
QMainWindow* qm=new QMainWindow();
qm->show();
return qa->exec();
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  qt