source: trunk/tools/assistant/book/assistant.leaf

Last change on this file was 191, checked in by rudi, 14 years ago

Qt Assistant added

File size: 23.2 KB
Line 
1\chapter Introduction
2
3This document introduces \QA, a tool for presenting on-line
4documentation. It also introduces the Qt Reference Documentation which
5is accessible using \QA, or with a web browser. The document is
6divided into the following sections:
7
8\list
9\i Introduction to the Qt Reference Documentation
10\i The 1 Minute Guide to using Qt Assistant
11\i Qt Assistant in More Detail
12\i Full Text Searching
13\i Customizing Qt Assistant
14\endlist
15
16\chapter Introduction to the Qt Reference Documentation
17
18The documentation for the Qt library is written in-line in the \File
19.cpp files by the developers themselves. The documentation team
20revises the documentation to ensure that it is accurate and usable,
21and to provide quality control. The documentation team also writes the
22larger texts, such as the class descriptions that introduce a class
23along with the concepts the class uses, as well as introducing the
24functions and properties that the class provides.
25
26The documentation focuses on the API rather than the internals, since
27we make great efforts to keep our API consistent and compatible with
28each new version, but we may change the internals considerably to improve
29performance and enhance functionality.
30
31The Qt Reference Documentation consists of almost 1,500 HTML pages
32(over 2,500 printed pages). The overwhelming majority of pages
33document Qt classes. Since developers differ in the way they
34think and work we provide a variety of approaches to navigating the
35documentation set:
36
37\list
38
39\i The \link classes.html All Classes\endlink page lists every class
40in Qt's public API, and consists of several hundred classes.
41
42\i The \link mainclasses.html Main Classes\endlink page lists the
43classes you're most likely to use most often, and provides a much
44shorter and more managable list than the All Classes list.
45
46\i The \link groups.html Grouped Classes\endlink page presents a list
47of groups, each of which leads to a list of related classes, for
48example, the \link advanced.html Advanced Widgets\endlink list.
49
50\i The \link hierarchy.html Inheritance Hierarchy\endlink page
51presents a list of classes in terms of the hierarchy of Qt classes.
52
53\i The \link functions.html All Functions\endlink page lists all the
54functions provided by Qt classes, each one with links to the class(es)
55in which it appears.
56
57\endlist
58
59No matter where you find yourself in the Qt documentation, you will
60find extensive cross-referencing. Even snippets of example code
61contain clickable links, so that for example, if you come across a
62class declaration in a code example, the class name will be a
63clickable link to the class's documentation.
64
65In addition to the class documentation some of Qt's modules have
66extensive descriptions, and there are many overview documents which
67describe various aspects of the Qt library; all these are linked from
68the reference documentation home page. There are also two tutorials
69and numerous example programs in the examples subdirectory of the Qt
70distribution.
71
72\chapter The 1 Minute Guide to Using Qt Assistant
73
74Under Windows, \QA is available as a menu option on the Qt menu. On
75Unix, run \c{assistant} from an xterm.
76
77When you start up \QA, you will be presented with a standard
78main-window style application, with a menu bar and toolbar. Below
79these, on the left hand side is a navigation window called the \e
80Sidebar, and on the right, taking up most of the space, is the
81documentation window. By default, the Qt Reference Documentation's home
82page is shown in the documentation window.
83
84\QA works in a similar way to a web browser. If you click underlined
85text (which signifies a cross-reference), the documentation window will
86present the relevant page. You can bookmark pages of particular
87interest and you can click the \Toolbutton Previous and \Toolbutton
88Next toolbar buttons to navigate within the pages you've visited.
89
90Although \QA can be used just like a web browser to navigate through
91the Qt documentation set, \QA offers a powerful means of navigation
92that web browsers don't provide. \QA uses an intelligent algorithm to
93index all the pages in the documentation sets that it presents so that
94you can search for particular words and phrases.
95
96To perform an index search, click the \Toolbutton Index tab on the Sidebar
97(or click \Key Ctrl+I). In the 'Look For' line edit enter a word, e.g.
98'homedirpath'. As you type, words are found and highlighted in a list
99beneath the line edit. If the highlighted text matches what you're
100looking for, double click it, (or press \Key Enter) and the
101documentation window will display the relevant page. You rarely have
102to type in the whole word before \QA finds a match. Note that for some
103words there may be more than one possible page that is relevant.
104
105\QA also provides full text searching for finding specific words in
106the documentation. Documents with the highest occurrences of the word
107that you are looking for appear first, and every occurrence of the
108word within the documentation is highlighted.
109
110\omit
111For example, enter 'setenabled' in the 'Look For' line edit.
112As you type, words are found and highlighted in the list beneath the
113line edit, as before. Once the highlighted text matches what you're
114looking for, double click it, (or press \Key Enter). In the case of
115setEnabled, it is a function name which occurs in several classes, so
116a dialog pops up listing the possible choices. Click the choice you're
117interested in (or move to it using the \Key Up and \Key Down arrow
118keys and press \Key Enter). The relevant page will display in the
119documentation window.
120\endomit
121
122\QA can be customized by creating profiles, a collection of
123documentation. Profiles can be created for your own use, or for an
124application you will distribute. With profiles, you can select which
125documentation you want the end user of your application to be able to
126view.
127
128\chapter Qt Assistant in More Detail
129
130\img assistant.png
131\caption Qt Assistant
132
133\section1 The Sidebar
134
135\img sidebar.png
136
137The sidebar provides four ways of navigating documentation:
138\list 1
139\i The \Toolbutton Contents tab presents a tree view of the
140documentation sets that are available. If you click an item, its
141documentation will appear in the documentation window. If you double
142click an item or click a '+' sign to the left of an item, the item's
143sub-items will appear. Click a sub-item to make its page appear in the
144documentation window. Click a '-' sign to the left of an item to hide
145its sub-items.
146\i The \Toolbutton Index tab is used to look up key words or phrases.
147See \l{The 1 Minute Guide to using Qt Assistant} for how to use this
148tab.
149\i The \Toolbutton Bookmarks tab lists any bookmarks you've made.
150Double click a bookmark to make its page appear in the documentation
151window. The \Toolbutton Bookmarks tab has a \Button{New Bookmark}
152button and a \Button{Delete Bookmark} button at the bottom. Click
153\Button{New Bookmark} to bookmark the page that is showing in the
154documentation window. Click a bookmark in the list, then click
155\Button{Delete Bookmark} to delete the highlighted bookmark.
156\i The \Toolbutton Search tab provides full text search of \e all
157the documents. See \l{Full Text Searching} for more information about
158this feature.
159\endlist
160
161If you want the documentation window to use as much space as possible,
162you can easily hide or show the Sidebar. If the Sidebar is showing,
163press \Key Ctrl+T, \Key Ctrl+I, \Key Ctrl+B or \Key Ctrl+S to hide it.
164If the Sidebar is hidden, press \Key Ctrl+T to show it on the Contents
165tab, or press \Key Ctrl+I to show it on the Index tab (with the focus
166in the 'Look For' line edit box), or press \Key Ctrl+B to show it on
167the Bookmarks tab, or press \Key Ctrl+S to show it on the (full text)
168Search tab.
169
170The Sidebar is a dock window, so you can drag it to the top, left,
171right or bottom of \QA's window, or you can drag it outside \QA to
172float it.
173
174\section1 The Documentation Window
175
176\img docwindow.png
177
178The documentation window offers a feature for viewing documentation by
179enabling you to create tabs for each documentation page that you view.
180Click the \Button {Add Tab} button and a new tab will appear with the
181page name as the tab's caption. This makes it convenient to switch
182between pages when you are working with different documentation. You
183can delete a tab by clicking the \Button {Close Tab} button located
184on the right side of the documentation window.
185
186\section1 The Toolbar
187
188\img toolbar1.png
189
190The toolbar provides fast access to the most common actions.
191\list
192\i \Toolbutton Previous takes you to the previous page. The menu
193option is \Menu Go|Previous and the keyboard shortcut is \Key{Alt+Left
194Arrow}.
195\i \Toolbutton Next takes you to the next page. The menu
196option is \Menu Go|Next and the keyboard shortcut is \Key{Alt+Right
197Arrow}.
198\i \Toolbutton Home takes you to the home page (normally the home page
199of the Qt Reference Documentation). The menu
200option is \Menu Go|Home and the keyboard shortcut is \Key{Ctrl+Home}.
201\i \Toolbutton Copy copies any selected text to the clipboard. The menu
202option is \Menu Edit|Copy and the keyboard shortcut is \Key{Ctrl+C}.
203\i \Toolbutton{Find in Text} invokes the \Dialog{Find Text} dialog. The menu
204option is \Menu{Edit|Find in Text} and the keyboard shortcut is \Key{Ctrl+F}.
205\i \Toolbutton{Print} invokes the \Dialog{Print} dialog. The menu
206option is \Menu{File|Print} and the keyboard shortcut is \Key{Ctrl+P}.
207\i \Toolbutton{Zoom in} increases the font size. The menu
208option is \Menu{View|Zoom in} and the keyboard shortcut is \Key{Ctrl++}.
209\i \Toolbutton{Zoom out} decreases the font size. The menu
210option is \Menu{View|Zoom out} and the keyboard shortcut is \Key{Ctrl+-}.
211\i \Toolbutton{What's This?} provides a description of a \QA feature.
212The menu option is \Menu{Help|What's This?} and the keyboard shortcut
213is \Key{Shift+F1}.
214\endlist
215
216The remaining toolbar buttons are bookmarks and will vary depending on
217your configuration.
218
219\section1 The Menus
220
221\section2 The File Menu
222
223\list
224\i \Menu{File|Print} invokes the \Dialog{Print} dialog.
225\i \Menu{File|Exit} terminates \QA.
226\endlist
227
228\section2 The Edit Menu
229
230\list
231\i \Menu{Edit|Copy} copies any selected text to the clipboard.
232\i \Menu{Edit|Find in Text} invokes the \Dialog{Find Text} dialog.
233\i \Menu{Edit|Settings} invokes the \Dialog{Settings} dialog.
234\endlist
235
236\section2 The View Menu
237
238\list
239\i \Menu{View|Zoom in} increases the font size.
240\i \Menu{View|Zoom out} decreases the font size.
241\i \Menu{View|Views|Sidebar} toggles the display of the Sidebar.
242\i \Menu{View|Views|Toolbar} toggles the display of the Toolbar.
243\i \Menu{View|Views|Line up} lines up the toolbar buttons in the
244Toolbar.
245\endlist
246
247\section2 The Go Menu
248
249\list
250\i \Menu{Go|Previous} displays the previous page.
251\i \Menu{Go|Next} displays the next page.
252\i \Menu{Go|home} goes to the home page.
253\endlist
254This menu also has additional items; these are pre-defined bookmarks
255that vary depending on your configuration.
256
257\section2 The Bookmarks Menu
258
259\list
260\i \Menu{Bookmarks|Add} adds the current page to the list of bookmarks.
261\endlist
262This menu may have additional items, i.e. any bookmarks that you have
263already made. If you want to delete a bookmark go to the Bookmarks tab
264on the Sidebar.
265
266\section1 The Dialogs
267
268\section2 The Print Dialog
269
270This dialog is platform-specific. It gives access to various printer
271options and can be used to print the current page.
272
273\section2 The Find Text Dialog
274
275This dialog is used to find text in the current page. Enter the text
276you want to find in the Find line edit. If you check the 'Whole words
277only' checkbox, the search will only consider whole words, i.e. if you
278search for 'spin' with this checkbox checked it will not match
279'spinbox', but will match 'spin'. If you check the 'Case sensitive'
280check box then, for example, 'spin' will match 'spin' but not 'Spin'.
281You can search Forward or Backward from your current position in the
282page by clicking one of the Direction radio buttons. Click the \Button
283Find button to search (or search again), and click the \Button Close
284button to finish.
285
286\section2 The Settings Dialog
287
288The Settings dialog is used to set your preferences for \QA. The
289dialog has four tabs: General Settings, Web Settings, PDF Settings,
290and Profiles. \QA will remember your settings between sessions,
291including window sizes and positions, and which pages you have open.
292Each of the tabs is discussed as follows:
293
294\list
295\i General Settings
296
297\img general.png
298
299To change the base font used throughout \QA, select a
300font type from the Font combobox. To choose a new fixed-width
301font, for example, to show code snippets, choose a font type from
302the 'Fixed font' combobox. To change the color of hypertext
303links, click the 'Link color' color button. Uncheck the
304'Underline links' checkbox if you don't want underlined links.
305
306\i Web Settings
307
308\img web.png
309
310Some pages contain links to external web pages. In order to display
311these links, you must specify a web browser. Type the name of your
312browser's executable in the Web Browser Application line edit.
313Alternatively, click the \Button {(ellipsis)} button to invoke the
314\Widget {Set Web Browser} dialog and navigate until you find the web
315browser you want to use. Click \Button {Save} to accept the selection.
316
317To change \QA's default home page, enter the file name in the Home
318Page line edit. Alternatively, click the \Button {(ellipsis)} button
319to invoke the \Widget {Set Homepage} dialog. Navigate until you find
320the home page file you want to use and then click \Button {Save} to
321accept the selection.
322
323\i PDF Settings
324
325\img pdf1.png
326
327Some pages contain links to PDF documents. In order to display these
328links, you must specify a PDF viewer. Type in the name of your PDF viewer's
329executable in the line edit. Alternatively, click the \Button {(ellipsis)}
330button to invoke the \Widget {Set PDF Browser} dialog and navigate
331until you find the PDF viewer you want to use. Click \Button Save to
332accept the selection.
333
334\chapter Full Text Searching
335
336\img search.png
337
338\QA provides a powerful full text search engine. To search
339for certain words or text, click the 'Search' tab in the sidebar. Then
340enter the text you want to look for and press \Key Enter or click
341\Button Search. The search is not case sensitive, so Foo, fOo and
342FOO are all treated as the same. The following are examples of common search
343patterns:
344
345\list
346\i \c deep -- lists all the documents that contain the word 'deep'
347
348\i \c{deep*} -- lists all the documents that contain a word beginning
349with 'deep'
350
351\i \c{deep copy} -- lists all documents that contain both 'deep' \e
352and 'copy'
353
354\i \c{"deep copy"} -- list all documents that contain the phrase 'deep copy'
355\endlist
356
357The wildcard (*) character cannot be used within quotes.
358
359The list of documents found is ordered according to the number of
360occurrences of the search text they contain, therefore those with the
361highest number of occurrences appearing first. Simply click any
362document in the list to display it in the document window.
363
364If the documentation has changed, i.e. if documents have been added or
365removed, \QA will reindex.
366
367\chapter Customizing Qt Assistant
368
369\QA can be customized by adding and removing documentation from its
370documentation set. In addition, \QA introduces the profiles option,
371which enables its properties to change, for example, the default
372startup page, and application icon.
373
374\section1 Modifying the Default Documentation Set
375
376When it is started without any options, \QA displays a default set of
377documentation. When Qt is installed, the default documentation set in
378\QA contains the Qt reference documentation as well as the tools that
379come with Qt, such as \QD and qmake.
380
381Documentation can be added or removed from \QA by
382adding and removing the content files. The format of the content files are
383specified below. To add a content file, type the following command line
384option: \c{-addContentFile docfile}. To remove a content file from the
385default set, type the following command line option:
386\c{-removeContentFile docfile}. For example:
387
388\code
3891: > assistant -addContentFile file.dcf
3902: > assistant
3913: > assistant -removeContentFile file.dcf
392\endcode
393
394In line one, we add the content file \c file.dcf. In line two, we start
395\QA. The default set will now be extended with the doc file
396\c file.dcf. In line three we remove the file \c file.dcf from the default
397documentation set so that subsequent use of \QA will not contain this
398file.
399
400\section2 Documentation Content File Format
401
402The Documentation Content File must contain the documentation's table
403of contents and all important keywords for the index. In addition, it
404may inherit an icon for the documentation which is displayed in the
405\QA toolbar. You can also specify an extra directory path for
406additional images used in the documentation.
407
408An example of a content file that uses all the available tags and
409attributes is shown below:
410\code
411<assistantconfig version="3.2.0">
412 <DCF ref="demo.html" icon="handbook.png" imagedir="../img/"
413 title="Development Demo Handbook">
414 <section ref="./chap1/chap1.html" title="Chapter1">
415 <section ref="./chap1/section1.html" title="Section1">
416 <keyword ref="./chap1/section1.html#foo">foo</keyword>
417 <keyword ref="./chap1/section1.html#bla">bla</keyword>
418 <section ref="./chap1/section1.html#subsection1" title="Subsection 1"/>
419 <section ref="./chap1/section1.html#subsection2" title="Subsection 2"/>
420 <section ref="./chap1/section1.html#subsection3" title="Subsection 3"/>
421 </section>
422 <section ref="./chap1/section2" title="Section2">
423 <section ref="./chap1/section2.html#subsection1" title="Subsection 1"/>
424 <section ref="./chap1/section2.html#subsection2" title="Subsection 2"/>
425 <section ref="./chap1/section2.html#subsection3" title="Subsection 3"/>
426 </section>
427 </section>
428 <section ref="./chap2/chap2.html" title="Chapter2">
429 <keyword ref="./chap2/chap2.html#foo">foo</keyword>
430 <section ref="./chap2/section1.html" title="Section1"/>
431 </section>
432 </DCF>
433</assistantconfig>
434\endcode
435
436Sections may be nested as deeply as necessary. All references should
437be related.
438
439Note that any \c keyword tags for a given section must appear \e
440before any sections nested within the given section.
441
442The paths in the \c refs attribute are always written Unix-style
443(forward slashes) and are relative to the location of the
444documentation content file itself.
445
446Since the introduction of the new root tag \c assistantconfig in the
447fileformat from Qt version 3.2.0, it is possible to specify multiple DCF tags in
448one file. Note that the old document contents file format, used up to
449Qt 3.2 is still valid.
450
451\section1 Profiles
452
453Profiles enable \QA to act as a specialized help tool for displaying
454documentation for applications. With profiles, the documentation
455writer can change properties such as \QA's title, application icons, and
456'about' dialogs. In addition, profiles can be used to run specialized
457documentation sets that are separate from the Qt docs. \QA can be
458customized by changing the following properties:
459
460\list
461
462\i Name- This property is used to name the profile. If multiple
463profiles are used for the same installation of \QA, this
464parameter is crucial to keep their profile specific settings
465apart. The property name is \c name
466
467\i Title- This property is used to specify a caption for \QA. The
468property name is \c title
469
470\i Application Icon- This property describes an icon that will be used
471as \QA application icon. The location of the icon is relative to the
472location of the profile. The property name is \c applicationicon
473
474\i Start Page- This property specifies which page \QA should initially
475display when the profile is used. Usually, this is the HTML file which
476contains the documentation's table of contents. This property also
477describes the default location to go to when pressing the home button
478in \QA's main user interface. The start page is specified relative to
479the location of the profile. The property name is \c startpage
480
481\i About Menu Text- This property describes the text that appears in
482the \Menu Help menu, e.g. About Application. The property name is \c
483aboutmenutext
484
485\i About URL- This property can be used to point to an HTML file that
486describes the contents in the About dialog that is opened for the
487\Menu Help menu, e.g. About Application. The url is specified relative
488to the location of the profile. The property name is \c abouturl
489
490\i \QA Documentation- This property describes the location of
491the \QA documentation. This is required since \QA provides
492self help, such as the full text search help and the \QA
493Manual option in the \Menu Help menu. The location is a directory
494relative to the location of the profile. The property name is \c
495assistantdocs.
496
497\endlist
498
499To define a profile, one needs to specify a \QA Document
500Profile, usually abbreviated \c{.adp}. The profile is an extension of
501the Documentation Content File described above. We add a \c profile
502tag containing \c property tags to the format.
503
504An example of a document profile file is shown below:
505
506\c helpdemo.adp
507
508\code
509<assistantconfig version="3.2.0">
510
511 <profile>
512 <property name="name">HelpExample</property>
513 <property name="title">Help Example</property>
514 <property name="applicationicon">logo.png</property>
515 <property name="startpage">index.html</property>
516 <property name="aboutmenutext">About Help</property>
517 <property name="abouturl">../about.txt</property>
518 <property name="assistantdocs">../../../doc/html</property>
519 </profile>
520
521 <DCF ref="index.html" icon="handbook.png" title="Help example">
522 <section ref="./manual.html" title="How to use this Example">
523 <keyword ref="./manual.html#installdocs">Install Docs</keyword>
524 <keyword ref="./manual.html#onlydoc">Example Profile</keyword>
525 <keyword ref="./manual.html#hide">Hide Sidebar</keyword>
526 <keyword ref="./manual.html#openqabutton">Open</keyword>
527 <keyword ref="./manual.html#closeqabutton">Close</keyword>
528 <keyword ref="./manual.html#display">Display</keyword>
529 </section>
530 </DCF>
531
532</assistantconfig>
533\endcode
534
535These files are XML files. Characters such as \c{<}, \c{>}, and \c{&}
536must be written as entities (e.g., \c{&lt;}, \c{&gt;}, \c{&amp;}).
537
538\section2 Using Profiles
539
540To use a profile, run \QA with the option \c {-profile filename}.
541This will load the profile specified in the file and will customize
542\QA accordingly. For example, to run \QA with the example
543file above, \c helpdemo.adp, we would run the command as follows:
544
545\code
546> assistant -profile helpdemo.adp
547\endcode
548
549See the HelpDemo example in the Qt distribution for a demonstration
550on how to use \QA with profiles for your own applications.
551
552When distributing \QA with your application, you will also need to
553copy the icon files from the \c QTDIR/tools/assistant/images
554directory so that \QA finds its icons.
555
556\omit
557For small documentation sets, the sidebar may not be necessary. You
558can hide the sidebar on startup with the following:
559\code
560assistant -hideSidebar
561\endcode
562\endomit
563
Note: See TracBrowser for help on using the repository browser.