Tanky WooRSS

QT学习笔记3--初试Qt Designer

21 Jan 2011
这篇博客是从旧博客 WordPress 迁移过来,内容可能存在转换异常。

《C++ GUI With QT4》,的2.3节。

一.不论是直接敲代码,还是使用Qt Designer,都要遵循以下五个基本步骤:

*1. *Create and initialize the child widgets.

*2. *Put the child widgets in layouts.

*3. *Set the tab order.

*4. *Establish signal–slot connections.

*5. *Implement the dialog's custom slots.

二.qmake命令是智能的。

The qmake tool is smart enough to detect the user interface file gotocelldialog.ui and to generate the appropriate makefile rules to invoke uic, Qt's user interface compiler. The uic tool converts gotocelldialog.ui into C++ and puts the result in ui_gotocelldialog.h.

The generated ui_gotocelldialog.h file contains the definition of the Ui::GoToCellDialog class, which is a C++ equivalent of the gotocelldialog.ui file. The class declares member variables that store the form's child widgets and layouts, and a setupUi() function that initializes the form.

三.关于qmake命令生成.pro和makefile文件:

其实现在的Qt Creator直接Build->Build All,就会生成.pro和makefile文件。

但是也可以使用qmake命令。因为对这方面不了解,在网上问了半天才知道如何做。

点击开始菜单,在QT一栏有Qt Command Prompt,这个就是QT的命令行工具。

使用cd命令转移路径到存放.ui文件的目录。

1.使用qmake -project命令生成xx.pro文件

2.使用qmake xx.pro生成makefile文件。

关于更多qmake命令的学习,可以去这里下载:

http://wenku.baidu.com/view/91d8fd2b3169a4517723a38d.html