文档详情

使用QT进行程序开发快速指导.doc

发布:2016-08-02约4.11千字共12页下载文档
文本预览下载声明
QT进行程序开发快速指导 版本 1.0 修订历史记录 日期 版本 操作 说明 作者 校核 批准 2013.08.07 1.0 目录 1 概述 4 2 较早版本Qt开发步骤 4 2.1.首先检查系统是否已安装qt 4 2.2.工程建立及编译转换 4 3 QT4.0结合VS2010开发指导。 9 3.1 安装 9 3.2 建立一个Qt Application 10 概述 本文介绍QT开发步骤,为qt入门提供简单的指导。第二章节主要介绍qt4.0以前版本 的开发过程。第三章节介绍qt4.0与vs2010结合开发。 较早版本Qt开发步骤 本步骤适合qt4.0以前的版本,但也可作为以后版本的参考,本部分参考别人文档,实践整理而来。 2.1.首先检查系统是否已安装qt [root@localhost root]# rpm -q qt如果出现qt-3.3.2-2 2.2.工程建立及编译转换 1.打开qt desinger(编程-Qt Designer) .新建一窗口(选择 Widget),如图1.png .添加一pushbutton .在按钮上单击右键,选择Connections... .单击New,添加signal.如图2.png .选择Edit Slots... ,编辑新的slots.如图3.png .单击New Function,在输入栏中输入新的slot函数名,openbtn().如图4.png .单击ok,在刚才的窗口中选择刚才创建的新slot.如图5.png .保存工程.按ctrl-s,输入文件名test.ui 1.进入终端窗口,进入保存test.ui的目录 1.使用进行文件转换. [root@localhost example]# uic test.ui -o test.h [root@localhost example]# uic -impl test.h test.ui -o test.cpp 1.使用编辑器建立主文件main.cpp #include qapplication.h #include test.h int main( int argc, char ** argv ) { QApplication a( argc, argv ); Form1 w; w.show(); a.connect( a, SIGNAL( lastWindowClosed() ), a, SLOT( quit() ) ); return a.exec(); } 13.使用qmake建立工程和make文件 [root@localhost example]# qmake -project [root@localhost example]# qmake -makefile 1.打开窗口文件test.cpp,看到如下内容 /**************************************************************************** ** Form implementation generated from reading ui file test.ui ** ** Created: 三 11月 7 19:55:21 2007 ** by: The User Interface Compiler ($Id: qt/main.cpp 3.3.2 edited Nov 24 13:47 $) ** ** WARNING! All changes made in this file will be lost! ****************************************************************************/ #include test.h #include qvariant.h #include qpushbutton.h #include qlayout.h #include qtooltip.h #include qwhatsthis.h /* * Constructs a Form1 as a child of parent, with the * name name and widget flags set to f. */ Form1::Form1( QWidget* parent, const char* name, WFlags fl )
显示全部
相似文档