|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the documentation of the Qt Toolkit. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:LGPL$ |
|
10 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
15 ** |
|
16 ** GNU Lesser General Public License Usage |
|
17 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 ** General Public License version 2.1 as published by the Free Software |
|
19 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 ** packaging of this file. Please review the following information to |
|
21 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 ** |
|
24 ** In addition, as a special exception, Nokia gives you certain additional |
|
25 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 ** |
|
28 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 |
|
42 /*! |
|
43 \page assistant-manual.html |
|
44 \title Qt Assistant Manual |
|
45 \ingroup qttools |
|
46 |
|
47 \startpage {index.html}{Qt Reference Documentation} |
|
48 \nextpage Qt Assistant in More Detail |
|
49 |
|
50 \keyword Qt Assistant |
|
51 |
|
52 This document introduces \QA, a tool for presenting on-line |
|
53 documentation. The document is divided into the following sections: |
|
54 |
|
55 Table of contents: |
|
56 |
|
57 \list |
|
58 \o \l{The One-Minute Guide to Using Qt Assistant} |
|
59 \o \l{Qt Assistant in More Detail} |
|
60 \o \l{Using Qt Assistant as a Custom Help Viewer} |
|
61 \endlist |
|
62 |
|
63 \chapter The One-Minute Guide to Using Qt Assistant |
|
64 |
|
65 Once you have installed Qt, \QA should be ready to run: |
|
66 |
|
67 \list |
|
68 \o On Windows, \QA is available as a menu option on the Qt menu. |
|
69 \o On Mac OS X, \QA is installed in the /Developer/Applications/Qt directory. |
|
70 \o On Unix/Linux, open a terminal, type \c{assistant} and press \key{Enter}. |
|
71 \endlist |
|
72 |
|
73 When you start up \QA, you will be presented with a standard main window |
|
74 application, with a menu bar and toolbar. Below these, on the left hand |
|
75 side are navigation windows called \e{Contents}, \e{Index} and \e{Bookmarks}. |
|
76 On the right, taking up most of the space, is the \e{Documentation} window. |
|
77 By default, \QA loads the Qt reference documentation along with the manuals |
|
78 of other Qt tools, like \QD or \QL. |
|
79 |
|
80 \QA works in a similar way to a Web browser. If you click hyperlinks |
|
81 (cross-references), the \e{Documentation} window will present the relevant |
|
82 page. You can bookmark pages of particular interest and you can click the |
|
83 \gui{Previous} and \gui{Next} toolbar buttons to navigate within the pages |
|
84 you have visited. |
|
85 |
|
86 Although \QA can be used just like a Web browser to navigate through |
|
87 the documentation, \QA offers a powerful means of navigation that Web |
|
88 browsers do not provide. \QA uses an advanced full text search engine |
|
89 to index all the pages in each compressed help file so that you can |
|
90 search for particular words and phrases. |
|
91 |
|
92 To perform an index search, click the \gui{Index} tab on the Sidebar |
|
93 (or press \key{Alt+I}). In the \gui{'Look For'} line edit enter a word; |
|
94 e.g., 'homedirpath'. As you type, words are found and highlighted in a list |
|
95 beneath the line edit. If the highlighted text matches what you're |
|
96 looking for, double click it, (or press \key{Enter}) and the |
|
97 \e{Documentation} window will display the relevant page. You rarely have |
|
98 to type in the whole word before \QA finds a match. Note that for some |
|
99 words there may be more than one possible page that is relevant. |
|
100 |
|
101 \QA also provides full text searching for finding specific words in |
|
102 the documentation. To activate the full text search, either press \key(Alt+S) |
|
103 or click on the \gui{Search} tab in the \e{Documentation} window. Then |
|
104 enter the term you're looking for and hit the \gui{Search} button. All |
|
105 documents containing the specified term will then be listed in the list box |
|
106 below. |
|
107 */ |
|
108 |
|
109 /*! |
|
110 \page assistant-details.html |
|
111 \title Qt Assistant in More Detail |
|
112 |
|
113 \contentspage {Qt Assistant Manual}{Contents} |
|
114 \previouspage Qt Assistant Manual |
|
115 \nextpage Using Qt Assistant as a Custom Help Viewer |
|
116 |
|
117 \tableofcontents |
|
118 |
|
119 \img assistant-assistant.png |
|
120 |
|
121 \section1 Command Line Options |
|
122 |
|
123 \QA handles the following command line options: |
|
124 |
|
125 \table |
|
126 \header |
|
127 \o Command Line Option |
|
128 \o Brief Description |
|
129 \row |
|
130 \o -collectionFile <file.qhc> |
|
131 \o Uses the specified collection file instead of the default one. |
|
132 \row |
|
133 \o -showUrl <URL> |
|
134 \o Shows the document referenced by URL. |
|
135 \row |
|
136 \o -enableRemoteControl |
|
137 \o Enables \QA to be remotly controlled. |
|
138 \row |
|
139 \o -show <widget> |
|
140 \o Shows the specified dockwidget which can be "contents", "index", |
|
141 "bookmarks" or "search". |
|
142 \row |
|
143 \o -hide <widget> |
|
144 \o Hides the specified dockwidget which can be "contents", "index", |
|
145 "bookmarks" or "search. |
|
146 \row |
|
147 \o -activate <widget> |
|
148 \o Activates the specified dockwidget which can be "contents", |
|
149 "index", "bookmarks" or "search. |
|
150 \row |
|
151 \o -register <doc.qch> |
|
152 \o Registers the specified compressed help file in the given help |
|
153 collection. |
|
154 \row |
|
155 \o -unregister <doc.qch> |
|
156 \o Unregisters the specified compressed help file from the given |
|
157 collection file. |
|
158 \row |
|
159 \o -remove-search-index |
|
160 \o Purges the help search engine's index. This option is |
|
161 useful in case the associated index files get corrupted. |
|
162 \QA will re-index the documentation at the next start-up. |
|
163 \row |
|
164 \o -setCurrentFilter <filter> |
|
165 \o Sets the given filter as the active filter. |
|
166 \row |
|
167 \o -quiet |
|
168 \o Doesn't show any error, warning or success messages. |
|
169 \endtable |
|
170 |
|
171 \section1 Tool Windows |
|
172 |
|
173 \img assistant-dockwidgets.png |
|
174 |
|
175 The tool windows provide four ways to navigate the documentation: |
|
176 |
|
177 \list |
|
178 \o The \gui{Contents} window presents a table of contents implemented as a |
|
179 tree view for the documentation that is available. If you click an item, |
|
180 its documentation will appear in the \e{Documentation} window. If you double |
|
181 click an item or click on the control to the left of it, the item's sub-items |
|
182 will appear. Click a sub-item to make its page appear in the \e{Documentation} |
|
183 window. Click on the control next to an open item to hide its sub-items. |
|
184 \o The \gui{Index} window is used to look up key words or phrases. |
|
185 See \l{Qt Assistant Manual#The One-Minute Guide to Using Qt Assistant}{The One-Minute Guide to Using Qt Assistant} for how to use this |
|
186 window. |
|
187 \o The \gui{Bookmarks} window lists any bookmarks you have made. Double |
|
188 click a bookmark to make its page appear in the \e{Documentation} window. |
|
189 The \gui{Bookmarks} window provides a context menu with \gui{Show Item}, |
|
190 \gui{Delete Item} as well as \gui{Rename Item}. Click in the main menu |
|
191 \menu{Bookmark|Add Bookmark...} (or press \key{Ctrl+B}) to bookmark the |
|
192 page that is currently showing in the \e{Documentation} window. Right click |
|
193 a bookmark in the list to rename or delete the highlighted bookmark. |
|
194 \endlist |
|
195 |
|
196 If you want the \gui{Documentation} window to use as much space as possible, |
|
197 you can easily group, move or hide the tool windows. To group the windows, |
|
198 drag one on top of the other and release the mouse. If one or all tool |
|
199 windows are not shown, press \key{Alt+C}, \key{Alt+I} or \key{Alt+O} to show |
|
200 the required window. |
|
201 |
|
202 The tool windows can be docked into the main window, so you can drag them |
|
203 to the top, left, right or bottom of \e{Qt Assistant's} window, or you can |
|
204 drag them outside \QA to float them as independent windows. |
|
205 |
|
206 \section1 Documentation Window |
|
207 |
|
208 \img assistant-docwindow.png |
|
209 |
|
210 The \gui{Documentation} window lets you create a tab for each |
|
211 documentation page that you view. Click the \gui{Add Tab} button and a new |
|
212 tab will appear with the page name as the tab's caption. This makes it |
|
213 convenient to switch between pages when you are working with different |
|
214 documentation. You can delete a tab by clicking the \gui{Close Tab} button |
|
215 located on the right side of the \gui{Documentation} window. |
|
216 |
|
217 \section1 Toolbars |
|
218 |
|
219 \img assistant-toolbar.png |
|
220 |
|
221 The main toolbar provides fast access to the most common actions. |
|
222 |
|
223 \table |
|
224 \header \o Action \o Description \o Menu Item \o Shortcut |
|
225 \row \o \gui{Previous} \o Takes you to the previous page in the history. |
|
226 \o \menu{Go|Previous} \o \key{Alt+Left Arrow} |
|
227 \row \o \gui{Next} \o Takes you to the next page in the history. |
|
228 \o \menu{Go|Next} \o \key{Alt+Right Arrow} |
|
229 \row \o \gui{Home} |
|
230 \o Takes you to the home page as specified in the Preferences Dialog. |
|
231 \o \menu{Go|Home} \o \key{Ctrl+Home}. |
|
232 \row \o \gui{Sync with Table of Contents} |
|
233 \o Synchronizes the \gui{Contents} tool window with the page currently |
|
234 shown in the \gui{Documentation} window. |
|
235 \o \menu{Go|Sync with Table of Contents} \o |
|
236 \row \o \gui{Copy} \o Copies any selected text to the clipboard. |
|
237 \o \menu{Edit|Copy} \o \key{Ctrl+C} |
|
238 \row \o \gui{Print} \o Opens the \gui{Print} dialog. |
|
239 \o \menu{File|Print} \o \key{Ctrl+P} |
|
240 \row \o \gui{Find in Text} \o Opens the \gui{Find Text} dialog. |
|
241 \o \menu{Edit|Find in Text} \o \key{Ctrl+F} |
|
242 \row \o \gui{Zoom in} |
|
243 \o Increases the font size used to display text in the current tab. |
|
244 \o \menu{View|Zoom in} \o \key{Ctrl++} |
|
245 \row \o \gui{Zoom out} |
|
246 \o Decreases the font size used to display text in the current tab. |
|
247 \o \menu{View|Zoom out} \o \key{Ctrl+-} |
|
248 \row \o \gui{Normal Size} |
|
249 \o Resets the font size to its normal size in the current tab. |
|
250 \o \menu{View|Normal Size} \o \key{Ctrl+0} |
|
251 \endtable |
|
252 |
|
253 \img assistant-address-toolbar.png |
|
254 |
|
255 The address toolbar provides a fast way to enter a specific URL for a |
|
256 documentation file. By default, the address toolbar is not shown, so it |
|
257 has to be activated via \menu{View|Toolbars|Address Toolbar}. |
|
258 |
|
259 \img assistant-filter-toolbar.png |
|
260 |
|
261 The filter toolbar allows you to apply a filter to the currently installed |
|
262 documentation. As with the address toolbar, the filter toolbar is not visible |
|
263 by default and has to be activated via \menu{View|Toolbars|Filter Toolbar}. |
|
264 |
|
265 \section1 Menus |
|
266 |
|
267 \section2 File Menu |
|
268 |
|
269 \list |
|
270 \o \menu{File|Page Setup...} invokes a dialog allowing you to define |
|
271 page layout properties, such as margin sizes, page orientation and paper size. |
|
272 \o \menu{File|Print Preview...} provides a preview of the printed pages. |
|
273 \o \menu{File|Print...} opens the \l{#Print Dialog}{\gui{Print} dialog}. |
|
274 \o \menu{File|New Tab} opens a new empty tab in the \gui{Documentation} |
|
275 window. |
|
276 \o \menu{File|Close Tab} closes the current tab of the |
|
277 \gui{Documentation} window. |
|
278 \o \menu{File|Exit} closes the \QA application. |
|
279 \endlist |
|
280 |
|
281 \section2 Edit Menu |
|
282 |
|
283 \list |
|
284 \o \menu{Edit|Copy} copies any selected text to the clipboard. |
|
285 \o \menu{Edit|Find in Text} invokes the \l{#Find Text Control}{\gui{Find Text} |
|
286 control} at the lower end of the \gui{Documentation} window. |
|
287 \o \menu{Edit|Find Next} looks for the next occurance of the specified |
|
288 text in the \gui{Find Text} control. |
|
289 \o \menu{Edit|Find Previous} looks for the previous occurance of |
|
290 the specified text in the \l{#Find Text Control}{\gui{Find Text} control}. |
|
291 \o \menu{Edit|Preferences} invokes the \l{#Preferences Dialog}{\gui{Preferences} dialog}. |
|
292 \endlist |
|
293 |
|
294 \section2 View Menu |
|
295 |
|
296 \list |
|
297 \o \menu{View|Zoom in} increases the font size in the current tab. |
|
298 \o \menu{View|Zoom out} decreases the font size in the current tab. |
|
299 \o \menu{View|Normal Size} resets the font size in the current tab. |
|
300 \o \menu{View|Contents} toggles the display of the \gui{Contents} tool window. |
|
301 \o \menu{View|Index} toggles the display of the \gui{Index} tool window. |
|
302 \o \menu{View|Bookmarks} toggles the display of the \gui{Bookmarks} tool window. |
|
303 \o \menu{View|Search} toggles the display of the Search in the \gui{Documentation} window. |
|
304 \endlist |
|
305 |
|
306 \section2 Go Menu |
|
307 |
|
308 \list |
|
309 \o \menu{Go|Home} goes to the home page. |
|
310 \o \menu{Go|Back} displays the previous page in the history. |
|
311 \o \menu{Go|Forward} displays the next page in the history. |
|
312 \o \menu{Go|Sync with Table of Contents} syncs the \gui{Contents} tool window to the currently shown page. |
|
313 \o \menu{Go|Next Page} selects the next tab in the \gui{Documentation} window. |
|
314 \o \menu{Go|Previous Page} selects the previous tab in the \gui{Documentation} window. |
|
315 \endlist |
|
316 |
|
317 \section2 Bookmarks Menu |
|
318 |
|
319 \list |
|
320 \o \menu{Bookmarks|Add} adds the current page to the list of bookmarks. |
|
321 \endlist |
|
322 |
|
323 \section1 Dialogs |
|
324 |
|
325 \section2 Print Dialog |
|
326 |
|
327 This dialog is platform-specific. It gives access to various printer |
|
328 options and can be used to print the document shown in the current tab. |
|
329 |
|
330 \section2 Preferences Dialog |
|
331 |
|
332 \img assistant-preferences-fonts.png |
|
333 |
|
334 The \menu{Fonts} page allows you to change the font family and font sizes of the |
|
335 browser window displaying the documentation or the application itself. |
|
336 |
|
337 \img assistant-preferences-filters.png |
|
338 |
|
339 The \menu{Filters} page lets you create and remove documentation |
|
340 filters. To add a new filter, click the \gui{Add} button, specify a |
|
341 filter name in the pop-up dialog and click \gui{OK}, then select |
|
342 the filter attributes in the list box on the right hand side. |
|
343 You can delete a filter by selecting it and clicking the \gui{Remove} |
|
344 button. |
|
345 |
|
346 \img assistant-preferences-documentation.png |
|
347 |
|
348 The \menu{Documentation} page lets you install and remove compressed help |
|
349 files. Click the \gui{Install} button and choose the path of the compressed |
|
350 help file (*.qch) you would like to install. |
|
351 To delete a help file, select a documentation set in the list and click |
|
352 \gui{Remove}. |
|
353 |
|
354 \img assistant-preferences-options.png |
|
355 |
|
356 The \menu{Options} page lets you specify the homepage \QA will display when |
|
357 you click the \gui{Home} button in \QA's main user interface. You can specify |
|
358 the hompage by typing it here or clicking on one of the buttons below the |
|
359 textbox. \gui{Current Page} sets the currently displayed page as your home |
|
360 page while \gui{Restore to default} will reset your home page to the default |
|
361 home page. |
|
362 |
|
363 \section1 Find Text Control |
|
364 |
|
365 This control is used to find text in the current page. Enter the text you want |
|
366 to find in the line edit. The search is incremental, meaning that the most |
|
367 relevant result is shown as you enter characters into the line edit. |
|
368 |
|
369 If you check the \gui{Whole words only} checkbox, the search will only consider |
|
370 whole words; for example, if you search for "spin" with this checkbox checked it will |
|
371 not match "spinbox", but will match "spin". If you check the \gui{Case sensitive} |
|
372 checkbox then, for example, "spin" will match "spin" but not "Spin". You can |
|
373 search forwards or backwards from your current position in the page by clicking |
|
374 the \gui{Previous} or \gui{Next} buttons. To hide the find control, either click the |
|
375 \gui{Close} button or hit the \key{Esc} key. |
|
376 |
|
377 \section1 Filtering Help Contents |
|
378 |
|
379 \QA allows you to install any kind of documentation as long as it is organized |
|
380 in Qt compressed help files (*.qch). For example, it is possible to install the |
|
381 Qt reference documentation for Qt 4.4.0 and Qt 4.4.1 at the same time. In many |
|
382 respects, this is very convenient since only one version of \QA is needed. |
|
383 However, at the same time it becomes more complicated when performing tasks like |
|
384 searching the index because nearly every keyword is defined in Qt 4.4.0 as well |
|
385 as in Qt 4.4.1. This means that \QA will always ask the user to choose which one |
|
386 should be displayed. |
|
387 |
|
388 We use documentation filters to solve this issue. A filter is identified by its |
|
389 name, and contains a list of filter attributes. An attribute is just a string and |
|
390 can be freely chosen. Attributes are defined by the documentation itself, this |
|
391 means that every documentation set usually has one or more attributes. |
|
392 |
|
393 For example, the Qt 4.4.0 \QA documentation defines the attributes \c {assistant}, |
|
394 \c{tools} and \c{4.4.0}, \QD defines \c{designer}, \c{tools} and \c{4.4.0}. |
|
395 The filter to display all tools would then define only the attribute |
|
396 \c{tools} since this attribute is part of both documentation sets. |
|
397 Adding the attribute \c{assistant} to the filter would then only show \QA |
|
398 documentation since the \QD documentation does not contain this |
|
399 attribute. Having an empty list of attributes in a filter will match all |
|
400 documentation; i.e., it is equivalent to requesting unfiltered documentation. |
|
401 |
|
402 \section1 Full Text Searching |
|
403 |
|
404 \img assistant-search.png |
|
405 |
|
406 \QA provides a powerful full text search engine. To search |
|
407 for certain words or text, click the \gui{Search} tab in the \gui{Documentation} |
|
408 window. Then enter the text you want to look for and press \key{Enter} |
|
409 or click the \gui{Search} button. The search is not case sensitive, so, |
|
410 for example, Foo, fOo and FOO are all treated as the same. The following are |
|
411 examples of common search patterns: |
|
412 |
|
413 \list |
|
414 \o \c deep -- lists all the documents that contain the word 'deep' |
|
415 \o \c{deep*} -- lists all the documents that contain a word beginning |
|
416 with 'deep' |
|
417 \o \c{deep copy} -- lists all documents that contain both 'deep' \e |
|
418 and 'copy' |
|
419 \o \c{"deep copy"} -- list all documents that contain the phrase 'deep copy' |
|
420 \endlist |
|
421 |
|
422 It is also possible to use the \gui{Advanced search} to get more flexibility. |
|
423 You can specify some words so that hits containing these are excluded from the |
|
424 result, or you can search for an exact phrase. Searching for similar words will |
|
425 give results like these: |
|
426 |
|
427 \list |
|
428 \o \c{QStin} -- lists all the documents with titles that are similar, such as \c{QString} |
|
429 \o \c{QSting} -- lists all the documents with titles that are similar, such as \c{QString} |
|
430 \o \c{QStrin} -- lists all the documents with titles that are similar, such as \c{QString} |
|
431 \endlist |
|
432 |
|
433 Options can be combined to improve the search results. |
|
434 |
|
435 The list of documents found is ordered according to the number of |
|
436 occurrences of the search text which they contain, with those containing |
|
437 the highest number of occurrences appearing first. Simply click any |
|
438 document in the list to display it in the \gui{Documentation} window. |
|
439 |
|
440 If the documentation has changed \mdash for example, if documents have been added |
|
441 or removed \mdash \QA will index them again. |
|
442 |
|
443 */ |
|
444 |
|
445 /*! |
|
446 \page assistant-custom-help-viewer.html |
|
447 \title Using Qt Assistant as a Custom Help Viewer |
|
448 |
|
449 \contentspage {Qt Assistant Manual}{Contents} |
|
450 \previouspage Qt Assistant in More Detail |
|
451 |
|
452 Using \QA as custom help viewer requires more than just being able to |
|
453 display custom documentation. It is equally important that the |
|
454 appearance of \QA can be customized so that it is seen as a |
|
455 application-specific help viewer rather than \QA. This is achieved by |
|
456 changing the window title or icon, as well as some application-specific |
|
457 menu texts and actions. The complete list of possible customizations |
|
458 can be found in the \l{Creating a Custom Help Collection File} section. |
|
459 |
|
460 Another requirement of a custom help viewer is the ability to receive |
|
461 actions or commands from the application it provides help for. This is |
|
462 especially important when the application offers context sensitive help. |
|
463 When used in this way, the help viewer may need to change its contents |
|
464 depending on the state the application is currently in. This means that |
|
465 the application has to communicate the current state to the help viewer. |
|
466 The section about \l{Using Qt Assistant Remotely} explains how this can |
|
467 be done. |
|
468 |
|
469 \tableofcontents |
|
470 |
|
471 The \l{Simple Text Viewer Example}{Simple Text Viewer} example uses the |
|
472 techniques described in this document to show how to use \QA as a custom |
|
473 help viewer for an application. |
|
474 |
|
475 \warning In order to ship Qt Assistant in your application, it is crucial |
|
476 that you include the sqlite plugin. For more information on how to include |
|
477 plugins in your application, refer to the \l{Deploying Qt Applications} |
|
478 {deployment documentation}. |
|
479 |
|
480 \section1 Qt Help Collection Files |
|
481 |
|
482 The first important point to know about \QA is that it stores all |
|
483 settings related to its appearance \e and a list of installed |
|
484 documentation in a help collection file. This means, when starting \QA |
|
485 with different collection files, \QA may look totally different. This |
|
486 complete separation of settings makes it possible to deploy \QA as a |
|
487 custom help viewer for more than one application on one machine |
|
488 without risk of interference between different instances of \QA. |
|
489 |
|
490 To apply a certain help collection to \QA, specify the respective |
|
491 collection file on the command line when starting it. For example: |
|
492 |
|
493 \snippet doc/src/snippets/code/doc_src_assistant-manual.qdoc 8 |
|
494 |
|
495 However, storing all settings in one collection file raises some problems. |
|
496 The collection file is usually installed in the same directory as the |
|
497 application itself, or one of its subdirectories. Depending on the |
|
498 directory and the operating system, the user may not have any permissions |
|
499 to modify this file which would happen when the user settings are stored. |
|
500 Also, it may not even be possible to give the user write permissions; |
|
501 e.g., when the file is located on a read-only medium like a CD-ROM. |
|
502 |
|
503 Even if it is possible to give everybody the right to store their settings |
|
504 in a globally available collection file, the settings from one user would |
|
505 be overwritten by another user when exiting \QA. |
|
506 |
|
507 To solve this dilemma, \QA creates user specific collection files which |
|
508 are more or less copied from the original collection file. The user-specific |
|
509 collection file will be saved in a subdirectory of the path returned by |
|
510 QDesktopServices::DataLocation. The subdirectory, or \e{cache directory} |
|
511 within this user-specific location, can be defined in the help collection |
|
512 project file. For example: |
|
513 |
|
514 \snippet doc/src/snippets/code/doc_src_assistant-manual.qdoc 7 |
|
515 |
|
516 So, when calling |
|
517 |
|
518 \snippet doc/src/snippets/code/doc_src_assistant-manual.qdoc 8 |
|
519 |
|
520 \QA actually uses the collection file: |
|
521 |
|
522 \snippet doc/src/snippets/code/doc_src_assistant-manual.qdoc 9 |
|
523 |
|
524 There is no need ever to start \QA with the user specific collection |
|
525 file. Instead, the collection file shipped with the application should |
|
526 always be used. Also, when adding or removing documentation from the |
|
527 collection file (see next section) always use the normal collection file. |
|
528 \QA will take care of synchronizing the user collection files when the |
|
529 list of installed documentation has changed. |
|
530 |
|
531 \section1 Displaying Custom Documentation |
|
532 |
|
533 Before \QA is able to show documentation, it has to know where it can |
|
534 find the actual documentation files, meaning that it has to know the |
|
535 location of the Qt compressed help file (*.qch). As already mentioned, |
|
536 \QA stores references to the compressed help files in the currently used |
|
537 collection file. So, when creating a new collection file you can list |
|
538 all compressed help files \QA should display. |
|
539 |
|
540 \snippet doc/src/snippets/code/doc_src_assistant-manual.qdoc 5 |
|
541 |
|
542 Sometimes, depending on the application for which \QA acts as a |
|
543 help viewer, more documentation needs to be added over time; for |
|
544 example, when installing more application components or plugins. |
|
545 This can be done manually by starting \QA, opening the \gui{Edit|Preferences} |
|
546 dialog and navigating to the \gui{Documentation} tab page. Then click |
|
547 the \gui{Add...} button, select a Qt compressed help file (*.qch) |
|
548 and press \gui{Open}. However, this approach has the disadvantage |
|
549 that every user has to do it manually to get access to the new |
|
550 documentation. |
|
551 |
|
552 The prefered way of adding documentation to an already existing collection |
|
553 file is to use the \c{-register} command line flag of \QA. When starting |
|
554 \QA with this flag, the documentation will be added and \QA will |
|
555 exit right away displaying a message if the registration was successful |
|
556 or not. |
|
557 |
|
558 \snippet doc/src/snippets/code/doc_src_assistant-manual.qdoc 6 |
|
559 |
|
560 The \c{-quiet} flag can be passed on to \QA to prevent it from writing |
|
561 out the status message. |
|
562 |
|
563 \bold{Note:} \QA will show the documentation in the contents view in the same |
|
564 order as it was registered. |
|
565 |
|
566 |
|
567 \section1 Changing the Appearance of Qt Assistant |
|
568 |
|
569 The appearance of \QA can be changed by passing different command line options |
|
570 on startup. However, these command line options only allow to show or hide |
|
571 specific widgets, like the contents or index view. Other customizations, such |
|
572 as changing the application title or icon, or disabling the filter functionality, |
|
573 can be done by creating a custom help collection file. |
|
574 |
|
575 \section2 Creating a Custom Help Collection File |
|
576 |
|
577 The help collection file (*.qhc) used by \QA is created when running the |
|
578 \c qcollectiongenerator tool on a help collection project file (*.qhcp). |
|
579 The project file format is XML and supports the following tags: |
|
580 |
|
581 \table |
|
582 \header |
|
583 \o Tag |
|
584 \o Brief Description |
|
585 \row |
|
586 \o \c{<title>} |
|
587 \o This property is used to specify a window title for \QA. |
|
588 \row |
|
589 \o \c{<homePage>} |
|
590 \o This tag specifies which page should be display when |
|
591 pressing the home button in \QA's main user interface. |
|
592 \row |
|
593 \o \c{<startPage>} |
|
594 \o This tag specifies which page \QA should initially |
|
595 display when the help collection is used. |
|
596 \row |
|
597 \o \c{<currentFilter>} |
|
598 \o This tag specifies the \l{Qt Assistant in More Detail#Preferences Dialog}{filter} |
|
599 that is initially used. |
|
600 If this filter is not specified, the documentation will not be filtered. This has |
|
601 no impact if only one documentation set is installed. |
|
602 \row |
|
603 \o \c{<applicationIcon>} |
|
604 \o This tag describes an icon that will be used instead of the normal \QA |
|
605 application icon. This is specified as a relative path from the directory |
|
606 containing the collection file. |
|
607 \row |
|
608 \o \c{<enableFilterFunctionality>} |
|
609 \o This tag is used to enable or disable user accessible filter functionality, |
|
610 making it possible to prevent the user from changing any filter when running \QA. |
|
611 It does not mean that the internal filter functionality is completely disabled. |
|
612 Set the value to \c{false} if you want to disable the filtering. If the filter |
|
613 toolbar should be shown by default, set the attribute \c{visible} to \c{true}. |
|
614 \row |
|
615 \o \c{<enableDocumentationManager>} |
|
616 \o This tag is used to specify whether the documentation manager should be shown |
|
617 in the preferences dialog. Disabling the Documentation Manager allows you to limit |
|
618 \QA to display a specific documentation set or make it impossible for the end user |
|
619 to accidentally remove or install documentation. To hide the documentation manager, |
|
620 set the tag value to \c{false}. |
|
621 \row |
|
622 \o \c{<enableAddressBar>} |
|
623 \o This tag describes if the address bar can be shown. By default it is |
|
624 enabled; if you want to disable it set the tag value to \c{false}. If the |
|
625 address bar functionality is enabled, the address bar can be shown by setting the |
|
626 tag attribute \c{visible} to \c{true}. |
|
627 \row |
|
628 \o \c{<aboutMenuText>, <text>} |
|
629 \o The \c{aboutMenuText} tag lists texts for different languages which will |
|
630 later appear in the \menu{Help} menu; e.g., "About Application". A text is |
|
631 specified within the \c{text} tags; the \c{language} attribute takes the two |
|
632 letter language name. The text is used as the default text if no language |
|
633 attribute is specified. |
|
634 \row |
|
635 \o \c{<aboutDialog>, <file>, <icon>} |
|
636 \o The \c{aboutDialog} tag can be used to specify the text for the \gui{About} |
|
637 dialog that can be opened from the \menu{Help} menu. The text is taken from the |
|
638 file in the \c{file} tags. It is possible to specify a different file or any |
|
639 language. The icon defined by the \c{icon} tags is applied to any language. |
|
640 \row |
|
641 \o \c{<cacheDirectory>} |
|
642 \o Specified as a path relative to the directory given by |
|
643 QDesktopServices::DataLocation, the cache path is used to store index files |
|
644 needed for the full text search and a copy of the collection file. |
|
645 The copy is needed because \QA stores all its settings in the collection file; |
|
646 i.e., it must be writable for the user. |
|
647 \endtable |
|
648 |
|
649 In addition to those \QA specific tags, the tags for generating and registering |
|
650 documentation can be used. See \l{The Qt Help Framework#Creating a Qt Help Collection} |
|
651 {Qt Help Collection} documentation for more information. |
|
652 |
|
653 An example of a help collection file that uses all the available tags is shown below: |
|
654 |
|
655 \snippet doc/src/snippets/code/doc_src_assistant-manual.qdoc 1 |
|
656 |
|
657 To create the binary collection file, run the \c qcollectiongenerator tool: |
|
658 |
|
659 \snippet doc/src/snippets/code/doc_src_assistant-manual.qdoc 10 |
|
660 |
|
661 To test the generated collection file, start \QA in the following way: |
|
662 |
|
663 \snippet doc/src/snippets/code/doc_src_assistant-manual.qdoc 8 |
|
664 |
|
665 \section1 Using Qt Assistant Remotely |
|
666 |
|
667 Even though the help viewer is a standalone application, it will mostly |
|
668 be launched by the application it provides help for. This approach |
|
669 gives the application the possibility to ask for specific help contents |
|
670 to be displayed as soon as the help viewer is started. Another advantage |
|
671 with this approach is that the application can communicate with the |
|
672 help viewer process and can therefore request other help contents to be |
|
673 shown depending on the current state of the application. |
|
674 |
|
675 So, to use \QA as the custom help viewer of your application, simply |
|
676 create a QProcess and specify the path to the Assistant executable. In order |
|
677 to make Assistant listen to your application, turn on its remote control |
|
678 functionality by passing the \c{-enableRemoteControl} command line option. |
|
679 |
|
680 \warning The trailing '\0' must be appended separately to the QByteArray, |
|
681 e.g., \c{QByteArray("command" + '\0')}. |
|
682 |
|
683 The following example shows how this can be done: |
|
684 |
|
685 \snippet doc/src/snippets/code/doc_src_assistant-manual.qdoc 2 |
|
686 |
|
687 Once \QA is running, you can send commands by using the stdin channel of |
|
688 the process. The code snippet below shows how to tell \QA to show a certain |
|
689 page in the documentation. |
|
690 |
|
691 \snippet doc/src/snippets/code/doc_src_assistant-manual.qdoc 3 |
|
692 |
|
693 The following commands can be used to control \QA: |
|
694 |
|
695 \table |
|
696 \header |
|
697 \o Command |
|
698 \o Brief Description |
|
699 \row |
|
700 \o \c{show <Widget>} |
|
701 \o Shows the dock widget specified by <Widget>. If the widget |
|
702 is already shown and this command is sent again, the widget will be |
|
703 activated, meaning that it will be raised and given the input focus. |
|
704 Possible values for <Widget> are "contents", "index", "bookmarks" or "search". |
|
705 \row |
|
706 \o \c{hide <Widget>} |
|
707 \o Hides the dock widget specified by <Widget>. Possible values for |
|
708 <Widget> are "contents", "index", "bookmarks" and "search". |
|
709 \row |
|
710 \o \c{setSource <Url>} |
|
711 \o Displays the given <Url>. The URL can be absolute or relative |
|
712 to the currently displayed page. If the URL is absolute, it has to |
|
713 be a valid Qt help system URL; i.e., starting with "qthelp://". |
|
714 \row |
|
715 \o \c{activateKeyword <Keyword>} |
|
716 \o Inserts the specified <Keyword> into the line edit of the |
|
717 index dock widget and activates the corresponding item in the |
|
718 index list. If such an item has more than one link associated |
|
719 with it, a topic chooser will be shown. |
|
720 \row |
|
721 \o \c{activateIdentifier <Id>} |
|
722 \o Displays the help contents for the given <Id>. An ID is unique |
|
723 in each namespace and has only one link associated to it, so the |
|
724 topic chooser will never pop up. |
|
725 \row |
|
726 \o \c{syncContents} |
|
727 \o Selects the item in the contents widget which corresponds to |
|
728 the currently displayed page. |
|
729 \row |
|
730 \o \c{setCurrentFilter} |
|
731 \o Selects the specified filter and updates the visual representation |
|
732 accordingly. |
|
733 \row |
|
734 \o \c{expandToc <Depth>} |
|
735 \o Expands the table of contents tree to the given depth. If depth |
|
736 is less than 1, the tree will be collapsed completely. |
|
737 \endtable |
|
738 |
|
739 If you want to send several commands within a short period of time, it is |
|
740 recommended that you write only a single line to the stdin of the process |
|
741 instead of one line for every command. The commands have to be separated by |
|
742 a semicolon, as shown in the following example: |
|
743 |
|
744 \snippet doc/src/snippets/code/doc_src_assistant-manual.qdoc 4 |
|
745 |
|
746 \section1 Compatibility with Old Formats |
|
747 |
|
748 In older versions of Qt, the help system was based on Document Content File |
|
749 (DCF) and Qt Assistant Documentation Profile (ADP) formats. In contrast, |
|
750 Qt Assistant and the help system used in Qt 4.4 use the formats described |
|
751 earlier in this manual. |
|
752 |
|
753 Unfortunately, the old file formats are not compatible with the new ones. |
|
754 In general, the differences are not that big \mdash in most cases is the old |
|
755 format is just a subset of the new one. One example is the \c namespace tag in |
|
756 the Qt Help Project format, which was not part of the old format, but plays a vital |
|
757 role in the new one. To help you to move to the new file format, we have created |
|
758 a conversion wizard. |
|
759 |
|
760 The wizard is started by executing \c qhelpconverter. It guides you through the |
|
761 conversion of different parts of the file and generates a new \c qch or \c qhcp |
|
762 file. |
|
763 |
|
764 Once the wizard is finished and the files created, run the \c qhelpgenerator |
|
765 or the \c qcollectiongenerator tool to generate the binary help files used by \QA. |
|
766 */ |
|
767 |
|
768 /* |
|
769 \section2 Modifying \QA with Command Line Options |
|
770 |
|
771 Different help collections can be shown by simply passing the help collection |
|
772 path to \QA. For example: |
|
773 |
|
774 \snippet doc/src/snippets/code/doc_src_assistant-manual.qdoc 0 |
|
775 |
|
776 Other available options the can be passed on the command line. |
|
777 |
|
778 \table |
|
779 \header |
|
780 \o Command Line Option |
|
781 \o Brief Description |
|
782 \row |
|
783 \o -collectionFile <file.qhc> |
|
784 \o Uses the specified collection file instead of the default one. |
|
785 \row |
|
786 \o -showUrl URL |
|
787 \o Shows the document referenced by URL. |
|
788 \row |
|
789 \o -enableRemoteControl |
|
790 \o Enables \QA to be remotly controlled. |
|
791 \row |
|
792 \o -show <widget> |
|
793 \o Shows the specified dockwidget which can be "contents", "index", |
|
794 "bookmarks" or "search". |
|
795 \row |
|
796 \o -hide <widget> |
|
797 \o Hides the specified dockwidget which can be "contents", "index", |
|
798 "bookmarks" or "search. |
|
799 \row |
|
800 \o -activate <widget> |
|
801 \o Activates the specified dockwidget which can be "contents", |
|
802 "index", "bookmarks" or "search. |
|
803 \row |
|
804 \o -register <doc.qch> |
|
805 \o Registers the specified compressed help file in the given help |
|
806 collection. |
|
807 \row |
|
808 \o -unregister <doc.qch> |
|
809 \o Unregisters the specified compressed help file from the given |
|
810 collection file. |
|
811 \row |
|
812 \o -quiet |
|
813 \o Doesn't show any error, warning or success messages. |
|
814 \endtable |
|
815 */ |