C++ GUI Programming with Qt3(系列四 试翻)

类别:编程语言 点击:0 评论:0 推荐:

 Line 20 sets the spin box value to 35. When this happens, the QSpinBox emits the valueChanged(int) signal with an int argument of 35. This argument is passed to the QSlider’s setValue(int) slot,which sets the slider value to 35.The slider then emits the valueChanged(int) signal, because its own value changed, triggering the spin box’s setValue(int) slot. But at this point, setValue(int) doesn’t emit any signal, since the spin box value is already 35. This prevents in?nite recursion. Figure 1.6 summarizes the situation.

第20行把spin box 的值设为35,接着QSpinBox 对象就发出了一个valueChanged(int)的消息,该消息带的值为35。这个参数将传递到QSlider的setValue(int)这个消息槽中(slot),他把slider对象的值设置为35。然后Slider对象也发出一个valueChanged(int)消息


Line 22 shows the QHBox and its two child widgets. Qt’s approach to building user interfaces is simple to understand and very flexible. The most common pattern that Qt programmers use is toinstantiate the required widgetsand then set their propertiesas necessary. Programmers add the widgets to layouts, which automatically take care of sizing and positioning.User interface behavior is managed by connecting widgets together using Qt’ssignals and slots mechanism.

 

第22行显示QHBox和他的两个子窗体控件。Qt的趋向于建立易于理解而且灵活的用户界面。Qt程序员的最通常的工作模式就是实例化一些控件,然后设置他的必要的属性。把控件加入到layouts(用于自动管理控件的大小和位置)上。用Qt的消息和消息槽机制来管理界面行为。 Using the Reference Documentation Using the Reference Documentation  Qt's reference documentation is an essential tool for any Qt developer,since it covers every class and function in Qt.(Qt 3.2 include over 400 public classes and over 6000 functions.) This book makes use of many Qt classes and functions,but it doesn't mention them all, nor does it provide all the details of those it does mention. To get the most benefit from Qt, you should familiarize yourself with the Qt reference documentation.

The documentation is available in HTML format in Qt’s doc\html directory and can be read using any web browser. You can also use Qt Assistant,the Qt help browser, whose powerful search and indexing features make it quicker and easier to use than a web browser. To launch Qt Assistant, click Qt 3.2.x|Qt Assistant in the Start menu on Windows, type assistant on the command line on Unix, or double-click assistant in the Mac OS X Finder.

 

使用参考文档  Qt 的参考文档是每个Qt程序员的基本工具。因为她覆盖了Qt中所有的类和所有的方法(Qt 3.2 中有400多个类和6000多个方法)。本书使用了很多Qt的类和方法,但是并没有提及他们中的所有。就是提到的类和方法中也没有能够提供所有细节。所以要想在Qt中获得最大的利益,你就的去熟悉Qt的参考文档。

 

在Qt的doc\html目录下你可以找到Qt参考文档的Html版,你可以使用任何浏览器阅读。你也可以使用Qt Assistant,Qt自己的帮助浏览器。他又强大的搜索和索引功能,你可以通过点击windows的开始菜单 Qt\3.2.X\Qt assistant(译:可以直接点击assistant.exe程序来启动) 来打开Qt Assisant。 在unix系统在命令行中敲入assistant。在Mac OSX 双击assistant。

本文地址:http://com.8s8s.com/it/it23419.htm