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 includes 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.

Widget Styles

The screenshots we have seen so far have been taken on Windows XP, but Qt applications look native on every supported platform. Qt achieves this by emulating the platform's look and feel, rather than wrapping a particular platform or toolkit's widget set.

Figure 1.7. Styles available everywhere

Qt application users can override the default style by using the style command-line option. For example, to launch the Age application with Platinum style on Unix, simply type

./age -style=Platinum

on the command line.

Figure 1.8. Platform-specific styles

Unlike the other styles, the Windows XP and Mac styles are only available on their native platforms, since they rely on the platforms' theme engines.

The documentation is available in HTML format in Qt's dochtml 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.

Figure 1.9. Qt's documentation in Qt Assistant

The links in the "API Reference" section on the home page provide different ways of navigating Qt's classes. The "All Classes" page lists every class in Qt's API. The "Main Classes" page lists only the most commonly used Qt classes. As an exercise, you might want to look up the classes and functions that we have used in this chapter. Note that inherited functions are documented in the base class; for example, QPushButton has no show() function of its own, but it inherits one from its ancestor QWidget. Figure 1.10 shows how the classes we have seen so far relate to each other.

Figure 1.10. Inheritance tree for the Qt classes seen so far

The reference documentation for the current version of Qt and for some earlier versions is available online at http://doc.trolltech.com/. This site also hosts selected articles from Qt Quarterly, the Qt programmers' newsletter sent to all commercial licensees.

Категории