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();
}