没有合适的资源?快使用搜索试试~ 我知道了~
首页Qt设计器手册(QT Designer)
Qt设计器手册(QT Designer)

QT Designer, Fully Bookmarked 图形用户界面设计软件设计指导书,很好适合初学和希望提高水平的开发人员.QT就不多介绍了,在Cross-Platform中也广泛应用........
资源详情
资源评论
资源推荐

主页 | 所有的类 | 主要的类 | 注释的类 | 分组的类 | 函数
Qt设计器手册
前言
创建一个Qt应用程序
创建含有工具栏和菜单的主窗口
走近设计器
派生类和动态对话框
创建自定义窗口部件
创建数据库应用程序
定制和集成Qt设计器
参考:快捷键
参考:菜单选项
参考:工具栏按钮
参考:对话框
参考:向导
参考:窗口
参考:.ui文件格式
Copyright © 2002 Trolltech Trademarks 译者:hackerjun Qt 3.0.5版
http://www.qtopia.org.cn/doc/qiliang.net/qt/designer-man...
第1页 共1页 2008-11-25 20:46

主页 | 所有的类 | 主要的类 | 注释的类 | 分组的类 | 函数
[Qt设计器首页] [下一章:创建一个Qt应用程序]
前言
介绍
这本参考手册是有关于Qt
设计器
的,Qt
设计器
是用来设计和实现用户界面并能够在多平台下使用的一种工具。Qt
设计器
可以使用户界面设计实
验变得简单。在任何时候你可以要求所生成的代码去重建Qt
设计器
产生的用户界面文件,并可以根据你的喜好来改变你的设计。假如你使用的
是先前的版本,你将发现在新的版本下自己可以立即进入工作,因为新的版本在界面上基本没有什么变化。但是你将发现根据你们的反馈而开
发出的新的部件和新的或者改进的功能。
Qt
设计器
帮助你使用部局工具在运行时自动的移动和缩放你的部件(Windows中的术语
控件
)来构建用户界面。最终界面是既好用又好看,使最
终用户拥有一个舒适的操作环境并且能够方便的进行参数选择。Qt
设计器
支持信号和槽机制以使部件间能够进行有效的通信。Qt
设计器
包含一
个代码编辑器,使你能够在合成的代码里面嵌入自己定制的槽。那些更喜欢使用手工方法分解合成代码的朋友也能够继续使用基类,因为从第
一版的Qt
设计器
开始就把这些基类移植进去了。
这本手册通过讲述开发例程来向你介绍Qt
设计器。
一开始的六章是设计指南,而且各自间都尽可能设计成是独立的。接下来要介绍的是除了首
章以外的每一章,并假定你已经熟悉了第一章的内容,该章包含使用Qt
设计器
创建一个Qt应用程序的基础。以下是便各章的简要概述:
第一章,创建一个Qt应用程序,通过带着你一步一步的创建一个小但功能完整的应用程序来介绍Qt
设计器
的使用。按照着这种方法你将学
到如何创建一个窗体并且向窗体中添加部件。在你阅读这一章的过程中你将使用窗体和属性编辑器来定制你的应用程序,并且学习怎样使
用部局工具来对一个窗体进行部局。你也将学到如何使用信号和槽机制和Qt
设计器
的内建代码编辑器来制造应用程序的各种功能。我们也
将解释如何使用qmake来生成Makefile,以致于你能够编译和运行应用程序。
第二章,创建含有工具栏和菜单的主窗口,我们将创建一个简单的文本编辑器。通过写这个应用程序你将学到如何使用菜单栏和工具栏来
创建一个主窗口。我们将看到如何使用Qt的内建功能来处理一般任务(e.g. 复制粘贴操作)还将看到如何为我们自己的菜单栏选项和工具栏按
钮创建我们自己的功能。
第三章,走近设计器,提供有关Qt
设计器
的信息如相关的开发应用程序,并且还对Qt
设计器
背后的一些基本原理进行解释。
第四章,派生类和动态对话框, 将展示如何派生一个窗体;这将让你清楚的通过执行关键代码的功能来分解用户界面。本章中还附加有关
qmake和 uic的信息。本章也将阐述如何使用QWidgetFactory把.ui文件放进你的应用程序从而动态的加载对话框和如何访问这些对话框的
部件和派生部件。
第五章,创建自定义窗口部件,告诉你如何才能创建自定义部件。既有在第一版的Qt
设计器
中就被介绍的简单方法,又有像利用插件这种
新的更有效的的方法都在这一章里被介绍了。
第六章, 创建数据库应用程序介绍了Qt的SQL类并且带着你通过一个实例来演示如何执行查询和如何设置主要关系的细节,深入讲解和处
理外关键字。
第七章,定制和集成Qt设计器,聚焦Qt
设计器
本身,向你展示如何定制设计器,如何使用可视化工作室集成设计器和如何创建一个
Makefiles。
这剩下的章节提供了一些参考资料,用以讲述Qt
设计器
的菜单选项、工具栏、快捷键以及对话框等的细节。
你所应该知道的
该手册假定你已经有了一些有关C++和Qt应用程序开发框架的基础。假如你需要学习C++或者Qt,这儿有大量的C++的书可供使用和少量的但是
数量却在不断增长的有关Qt的书。你可以尝试一下大量伴随着Qt的联机文档和许多例程。
企业版的Qt包含了SQL模块。在创建数据库应用程序一章里我们演示了如何使用Qt
设计器
来编写SQL应用程序;这一章需要一些SQL和关系数据
库的知识。
Qt
设计器
中的新东西
该版本的Qt
设计器
较其前一版本来说增加了更加多的功能。自己定制的槽功能代码可以直接在Qt
设计器
中编辑;操作工具栏、菜单栏就可以创
建主窗口了;部局可以结合使用分解器;一些插件还允许你把大量的自定义部件进行打包并且在Qt
设计器
中可以使用他们。从对用户界面微小
的改善到提高效率还有很多其它增强功能被结使在里面,例如在一个应用程序里的所有窗体可以有效的共享像素映射。
该版本的Qt
设计器
创建的工程文件使得开关在一个应用程序中的所有窗体变得十分简单,而且仍然保持了一个通常的数据库设置和映象。通过
对派生类的全面支持,为直接在Qt
设计器
中编写代码带来了很多的益处,这些知识已经全面涵盖在走近设计器一章中了。
还介绍了一个新的库libqui,该库允许你在运行时从Qt
设计器
的.ui文件中自动加载对话框。这允计你提供给你的应用程序用户相当可观的自定
义界面自由度,否则就需要使用C++了。
如果你仅仅想要一个简单而功能强大的单对话框可视设计工具,虽然新版本的Qt
设计器
介绍了新的进阶和技术但你可以忽略这些方面并且正确
的使用与Qt 2.x相同的方法。
http://www.qtopia.org.cn/doc/qiliang.net/qt/designer-man...
第1页 共2页 2008-11-25 20:44

Qt
设计器
反馈
如果你关于这个手册有一些注释、建议、批评或者适当的赞美,请访问doc@trolltech.com让我们知道。关于Qt或者Qt
设计器
的bug报告可以发
送至Qt-bugs@trolltech.com。你也许也想要加入专门由开发者阅读和捐献的Qt-interest邮件列表;请访问http://www.trolltech.com以了解更多的
细节。
[Qt设计器首页] [下一章:创建一个Qt应用程序]
Copyright © 2002 Trolltech Trademarks 译者:hackerjun Qt 3.0.5版
http://www.qtopia.org.cn/doc/qiliang.net/qt/designer-man...
第2页 共2页 2008-11-25 20:44

Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions
[Prev: Preface] [Home] [Next: Creating Main Windows with Actions, Toolbars and Menus]
Creating a Qt Application
Starting and Exiting Qt Designer
Qt Designer is controlled in the same way as any other modern desktop application. To start Qt Designer
under Windows click the Start button and click Programs|Qt X.x.x|Designer. (X.x.x is the Qt version
number, e.g. 3.0.0.) If you're running a Unix or Linux operating system you can either double click the Qt
Designer icon or enter designer & in an xterm.
When you've finished using Qt Designer click File|Exit; you will be prompted to save any unsaved
changes. Help is available by pressing F1 or from the Help menu.
To get the most benefit from the tutorial chapters we recommend that you start Qt Designer now and
create the example applications as you read. Most of the work involves using Qt Designer's menus,
dialogs and editors, with only small amounts of code to type in.
When you start Qt Designer, by default, you will see a menu bar and various toolbars at the top. On the
left hand side are three windows, the first is the Files window, the second is the Widgets and Source
window (the Object Explorer) and the third is the Properties window. The Files window lists the files and
images associated with the project; to open any form single click it in the Files list. The Widgets and
Source window lists the current form's widgets and slots. The Properties window is used to view and
change the properties of forms and widgets. We will cover the use of Qt Designer's windows, dialogs,
menu options and toolbar buttons as we create example applications.
In this chapter we will build an application called 'multiclip' which allows you to store and retrieve
multiple text clippings to and from the clipboard.
The Multiclip Application
Creating a New Project
Whenever you create a new application we strongly recommend that you create a project file and open
the project rather than individual .ui files. Using a project has the advantage that all the forms you create
for the project are available via a single mouse click rather than having to be loaded individually through
Creating a Qt Application http://www.qtopia.org.cn/doc/qiliang.net/qt/designer-man...
第1页 共23页 2008-11-25 20:46

file open dialogs. An additional benefit of using project files is that they allow you to store all your images
in a single file rather than duplicate them in each form in which they appear. See The Designer Approach
chapter's Project management section for detailed information on the benefits of using project files.
Start Qt Designer if you haven't already. Click File|New to invoke the New File dialog. Click the 'C++
Project' icon, then click OK to invoke the Project Settings dialog. You need to give the project a name,
and we recommend that you put each project in its own subdirectory. Click the ellipsis ... button to invoke
the Save As dialog and navigate to where you want to put the new project. Click the Create New Folder
toolbar button to create the 'multiclip' directory. Double click the 'multiclip' directory to make it the
current directory. Enter a file name of 'multiclip.pro', and click the Save button. The 'Project File' field of
the Project Settings dialog will have the path and name of your new project; click OK to create the
project.
Creating a New Project
The name of the current project is shown in the Files toolbar which is the top left toolbar by default. Once
we have a project we can add forms and begin to build our application. (See Customizing Qt Designer for
information on changing Qt Designer's toolbars and windows to suit your preferences.)
Creating a New Form
Click File|New to invoke the New File dialog. Several default forms are supplied but we will use the
default Dialog form, so just click OK. A new form called 'Form1' will appear. Note that the new form is
listed in the Files list and the Properties window shows the form's default property settings.
Click the Value beside the name property and change the form's name to 'MulticlipForm'. Change the
form's caption to 'Multiclip'. The properties are ordered in accordance with the inheritance hierarchy, and
caption is roughly in the middle of the property editor. Save the form: click File|Save, enter the name
'multiclip.ui', then click the Save button.
Creating a Qt Application http://www.qtopia.org.cn/doc/qiliang.net/qt/designer-man...
第2页 共23页 2008-11-25 20:46
剩余158页未读,继续阅读


















安全验证
文档复制为VIP权益,开通VIP直接复制

评论8