int main(int argc,char*argv[]) {
QApplication a(argc, argv);
Widget w;
w.show();//为什么能调用show
return a.exec();//返回的是什么 }
标准的main.cpp
#include"widget.h" #include
"ui_widget.h"
Widget::Widget(QWidget
*parent):QWidget(parent)
,ui(new
Ui::Widget)
//传两个参数,第一个是继承的基类需要的参数,第二个是自己需要参数
有什么用?
{
ui->setupUi(this);//这个函数是什么,this是谁的?有什么用 }
Widget::~Widget() { delete ui; }
标准的另一个.cpp文件
以上这三个都是建立好工程以后自动生成的,不需要编译
还有一个系统编译生成.h文件
/********************************************************************************
** Form generated from reading UI file 'widget.ui'
**
** Created: Mon Nov 22 20:46:49 2010
** by: Qt User Interface Compiler version 4.7.0
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/