This file is indexed.

/usr/share/qt5/doc/qtassistant/assistant-custom-help-viewer.html is in qttools5-doc-html 5.2.1-8build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- assistant-manual.qdoc -->
  <title>Customizing Qt Assistant | QtAssistant </title>
  <link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
    <div class="main">
    <div class="main-rounded">
        <div class="navigationbar">
        <ul>
<li>Qt 5.2</li>
<li><a href="qtassistant-index.html">Qt Assistant Manual</a></li>
<li>Customizing Qt Assistant</li>
<li id="buildversion">
Qt 5.2.1 Reference Documentation</li>
    </ul>
    </div>
</div>
<div class="content">
<div class="line">
<div class="content mainContent">
  <link rel="prev" href="assistant-details.html" />
<p class="naviNextPrevious headerNavi">
<a class="prevPage" href="assistant-details.html">Using Qt Assistant</a>
</p><p/>
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#qt-help-collection-files">Qt Help Collection Files</a></li>
<li class="level1"><a href="#displaying-custom-documentation">Displaying Custom Documentation</a></li>
<li class="level1"><a href="#changing-the-appearance-of-qt-assistant">Changing the Appearance of Qt Assistant</a></li>
<li class="level2"><a href="#creating-a-custom-help-collection-file">Creating a Custom Help Collection File</a></li>
<li class="level1"><a href="#using-qt-assistant-remotely">Using Qt Assistant Remotely</a></li>
<li class="level1"><a href="#compatibility-with-old-formats">Compatibility with Old Formats</a></li>
</ul>
</div>
<h1 class="title">Customizing Qt Assistant</h1>
<span class="subtitle"></span>
<!-- $$$assistant-custom-help-viewer.html-description -->
<div class="descr"> <a name="details"></a>
<p>Using <i>Qt Assistant</i> as custom help viewer requires more than just being able to display custom documentation. It is equally important that the appearance of <i>Qt Assistant</i> can be customized so that it is seen as a application-specific help viewer rather than <i>Qt Assistant</i>. This is achieved by changing the window title or icon, as well as some application-specific menu texts and actions. For a complete list of possible customizations, see <a href="#creating-a-custom-help-collection-file">Creating a Custom Help Collection File</a>.</p>
<p>Another requirement of a custom help viewer is the ability to receive actions or commands from the application it provides help for. This is especially important when the application offers context sensitive help. When used in this way, the help viewer may need to change its contents depending on the state the application is currently in. This means that the application has to communicate the current state to the help viewer. For more information, see <a href="#using-qt-assistant-remotely">Using Qt Assistant Remotely</a>.</p>
<p>The <a href="qtassistant-simpletextviewer-example.html">Simple Text Viewer</a> example uses the techniques described in this document to show how to use <i>Qt Assistant</i> as a custom help viewer for an application.</p>
<p><b>Warning:</b> In order to ship Qt Assistant in your application, it is crucial that you include the sqlite plugin. For more information on how to include plugins in your application, refer to the deployment documentation.</p>
<a name="qt-help-collection-files"></a>
<h2>Qt Help Collection Files</h2>
<p>The first important point to know about <i>Qt Assistant</i> is that it stores all settings related to its appearance <i>and</i> a list of installed documentation in a help collection file. This means, when starting <i>Qt Assistant</i> with different collection files, <i>Qt Assistant</i> may look totally different. This complete separation of settings makes it possible to deploy <i>Qt Assistant</i> as a custom help viewer for more than one application on one machine without risk of interference between different instances of <i>Qt Assistant</i>.</p>
<p>To apply a certain help collection to <i>Qt Assistant</i>, specify the respective collection file on the command line when starting it. For example:</p>
<pre class="cpp">assistant <span class="operator">-</span>collectionFile mycollection<span class="operator">.</span>qhc</pre>
<p>However, storing all settings in one collection file raises some problems. The collection file is usually installed in the same directory as the application itself, or one of its subdirectories. Depending on the directory and the operating system, the user may not have any permissions to modify this file which would happen when the user settings are stored. Also, it may not even be possible to give the user write permissions, for example when the file is located on a read-only medium like a CD-ROM.</p>
<p>Even if it is possible to give everybody the right to store their settings in a globally available collection file, the settings from one user would be overwritten by another user when exiting <i>Qt Assistant</i>.</p>
<p>To solve this dilemma, <i>Qt Assistant</i> creates user specific collection files which are more or less copied from the original collection file. The user-specific collection file will be saved in a subdirectory of the path returned by QDesktopServices::DataLocation. The subdirectory, or <i>cache directory</i> within this user-specific location, can be defined in the help collection project file. For example:</p>
<pre class="cpp"><span class="operator">&lt;</span><span class="operator">?</span>xml version<span class="operator">=</span><span class="string">&quot;1.0&quot;</span> encoding<span class="operator">=</span><span class="string">&quot;utf-8&quot;</span> <span class="operator">?</span><span class="operator">&gt;</span>
<span class="operator">&lt;</span><span class="type">QHelpCollectionProject</span> version<span class="operator">=</span><span class="string">&quot;1.0&quot;</span><span class="operator">&gt;</span>
    <span class="operator">&lt;</span>assistant<span class="operator">&gt;</span>
        <span class="operator">&lt;</span>title<span class="operator">&gt;</span>My Application Help<span class="operator">&lt;</span><span class="operator">/</span>title<span class="operator">&gt;</span>
        <span class="operator">&lt;</span>cacheDirectory<span class="operator">&gt;</span>mycompany<span class="operator">/</span>myapplication<span class="operator">&lt;</span><span class="operator">/</span>cacheDirectory<span class="operator">&gt;</span>
        <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
    <span class="operator">&lt;</span><span class="operator">/</span>assistant<span class="operator">&gt;</span>
<span class="operator">&lt;</span><span class="operator">/</span><span class="type">QHelpCollectionProject</span><span class="operator">&gt;</span></pre>
<p>So, when calling</p>
<pre class="cpp">assistant <span class="operator">-</span>collectionFile mycollection<span class="operator">.</span>qhc</pre>
<p><i>Qt Assistant</i> actually uses the collection file:</p>
<pre class="cpp"><span class="operator">%</span><span class="type">QDesktopServices</span><span class="operator">::</span>DataLocation<span class="operator">%</span><span class="operator">/</span>mycompany<span class="operator">/</span>myapplication<span class="operator">/</span>mycollection<span class="operator">.</span>qhc</pre>
<p>There is no need ever to start <i>Qt Assistant</i> with the user specific collection file. Instead, the collection file shipped with the application should always be used. Also, when adding or removing documentation from the collection file (see next section) always use the normal collection file. <i>Qt Assistant</i> will take care of synchronizing the user collection files when the list of installed documentation has changed.</p>
<a name="displaying-custom-documentation"></a>
<h2>Displaying Custom Documentation</h2>
<p>Before <i>Qt Assistant</i> is able to show documentation, it has to know where it can find the actual documentation files, meaning that it has to know the location of the Qt compressed help file (*.qch). As already mentioned, <i>Qt Assistant</i> stores references to the compressed help files in the currently used collection file. So, when creating a new collection file you can list all compressed help files <i>Qt Assistant</i> should display.</p>
<pre class="cpp"><span class="operator">&lt;</span><span class="operator">?</span>xml version<span class="operator">=</span><span class="string">&quot;1.0&quot;</span> encoding<span class="operator">=</span><span class="string">&quot;utf-8&quot;</span> <span class="operator">?</span><span class="operator">&gt;</span>
<span class="operator">&lt;</span><span class="type">QHelpCollectionProject</span> version<span class="operator">=</span><span class="string">&quot;1.0&quot;</span><span class="operator">&gt;</span>
    <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
    <span class="operator">&lt;</span>docFiles<span class="operator">&gt;</span>
        <span class="operator">&lt;</span><span class="keyword">register</span><span class="operator">&gt;</span>
            <span class="operator">&lt;</span>file<span class="operator">&gt;</span>myapplication<span class="operator">-</span>manual<span class="operator">.</span>qch<span class="operator">&lt;</span><span class="operator">/</span>file<span class="operator">&gt;</span>
            <span class="operator">&lt;</span>file<span class="operator">&gt;</span>another<span class="operator">-</span>manual<span class="operator">.</span>qch<span class="operator">&lt;</span><span class="operator">/</span>file<span class="operator">&gt;</span>
        <span class="operator">&lt;</span><span class="operator">/</span><span class="keyword">register</span><span class="operator">&gt;</span>
    <span class="operator">&lt;</span><span class="operator">/</span>docFiles<span class="operator">&gt;</span>
<span class="operator">&lt;</span><span class="operator">/</span><span class="type">QHelpCollectionProject</span><span class="operator">&gt;</span></pre>
<p>Sometimes, depending on the application for which <i>Qt Assistant</i> acts as a help viewer, more documentation needs to be added over time; for example, when installing more application components or plugins. This can be done manually in <i>Qt Assistant</i> by selecting <b>Edit</b> &gt; <b>Preferences</b> &gt; <b>Documentation</b>. However, this approach has the disadvantage that every user has to do it manually to get access to the new documentation.</p>
<p>The preferred way of adding documentation to an already existing collection file is to use the <tt>-register</tt> command line flag of <i>Qt Assistant</i>. When starting <i>Qt Assistant</i> with this flag, the documentation will be added and <i>Qt Assistant</i> will exit right away displaying a message if the registration was successful or not.</p>
<p>The search indexing will only index your custom *.html, *.htm, and *.txt files.</p>
<pre class="cpp">assistant <span class="operator">-</span>collectionFile mycollection<span class="operator">.</span>qhc <span class="operator">-</span><span class="keyword">register</span> myapplication<span class="operator">-</span>manual<span class="operator">.</span>qch</pre>
<p>The <tt>-quiet</tt> flag can be passed on to <i>Qt Assistant</i> to prevent it from writing out the status message.</p>
<p><b>Note: </b><i>Qt Assistant</i> shows the documentation in the <b>Contents</b> view in the same order as it was registered.</p><a name="changing-the-appearance-of-qt-assistant"></a>
<h2>Changing the Appearance of Qt Assistant</h2>
<p>The appearance of <i>Qt Assistant</i> can be changed by passing different command line options on startup. However, these command line options only allow to show or hide specific widgets, like the contents or index view. Other customizations, such as changing the application title or icon, or disabling the filter functionality, can be done by creating a custom help collection file.</p>
<a name="creating-a-custom-help-collection-file"></a>
<h3>Creating a Custom Help Collection File</h3>
<p>The help collection file (*.qhc) used by <i>Qt Assistant</i> is created when running the <tt>qcollectiongenerator</tt> tool on a help collection project file (*.qhcp). The project file format is XML and it supports the following tags:</p>
<table class="generic">
 <thead><tr class="qt-style"><th >Tag</th><th >Brief Description</th></tr></thead>
<tr valign="top" class="odd"><td ><tt>&lt;title&gt;</tt></td><td >Specifies a window title for <i>Qt Assistant</i>.</td></tr>
<tr valign="top" class="even"><td ><tt>&lt;homePage&gt;</tt></td><td >Specifies the page to display when selecting <b>Home</b> in the <i>Qt Assistant</i> main window.</td></tr>
<tr valign="top" class="odd"><td ><tt>&lt;startPage&gt;</tt></td><td >Specifies the page to display initially when the help collection is used.</td></tr>
<tr valign="top" class="even"><td ><tt>&lt;currentFilter&gt;</tt></td><td >Specifies the filter that is initially used. If this filter is not specified, the documentation will not be filtered. This has no impact if only one documentation set is installed.</td></tr>
<tr valign="top" class="odd"><td ><tt>&lt;applicationIcon&gt;</tt></td><td >Describes an icon that will be used instead of the normal <i>Qt Assistant</i> application icon. This is specified as a relative path from the directory containing the collection file.</td></tr>
<tr valign="top" class="even"><td ><tt>&lt;enableFilterFunctionality&gt;</tt></td><td >Enables or disables user accessible filter functionality, making it possible to prevent the user from changing any filter when running <i>Qt Assistant</i>. It does not mean that the internal filter functionality is completely disabled. Set the value to <tt>false</tt> if you want to disable the filtering. If the filter toolbar should be shown by default, set the attribute <tt>visible</tt> to <tt>true</tt>.</td></tr>
<tr valign="top" class="odd"><td ><tt>&lt;enableDocumentationManager&gt;</tt></td><td >Shows or hides the <b>Documentation</b> tab in the <b>Preferences</b> dialog. Disabling the <b>Documentation</b> tab allows you to limit <i>Qt Assistant</i> to display a specific documentation set or make it impossible for the end user to accidentally remove or install documentation. To hide the <b>Documentation</b> tab, set the tag value to <tt>false</tt>.</td></tr>
<tr valign="top" class="even"><td ><tt>&lt;enableAddressBar&gt;</tt></td><td >Enables or disables the address bar functionality. By default it is enabled. To disable it, set the tag value to <tt>false</tt>. If the address bar functionality is enabled, the address bar can be shown by setting the tag attribute <tt>visible</tt> to <tt>true</tt>.</td></tr>
<tr valign="top" class="odd"><td ><tt>&lt;aboutMenuText&gt;, &lt;text&gt;</tt></td><td >Lists localized versions for the <b>About</b> menu item in the <b>Help</b> menu. For example, <b>About Application</b>. The text is specified within the <tt>text</tt> tags. The <tt>language</tt> attribute takes the two letter language name. The text is used as the default text if no language attribute is specified.</td></tr>
<tr valign="top" class="even"><td ><tt>&lt;aboutDialog&gt;, &lt;file&gt;, &lt;icon&gt;</tt></td><td >Specifies the text for the <b>About</b> dialog that can be opened from the <b>Help</b> menu. The text is taken from the file in the <tt>file</tt> tags. It is possible to specify a different file or any language. The icon defined by the <tt>icon</tt> tags is applied to any language.</td></tr>
<tr valign="top" class="odd"><td ><tt>&lt;cacheDirectory base=&quot;collection &gt; default&quot;&gt;</tt></td><td >Specifies the cache directory that is used to store index files needed for the full text search and a copy of the collection file. The copy is needed because <i>Qt Assistant</i> stores all its settings in the collection file, and therefore, it must be writable for the user. The directory is specified as a relative path. If the <tt>base</tt> attribute is set to &quot;collection&quot;, the path is relative to the directory the collection file resides in. If the attribute is set to &quot;default&quot; or if it is missing, the path is relative to the directory given by QDesktopServices::DataLocation. The first form is useful for collections that are used in a <i>mobile</i> way, such as carried around on a USB stick.</td></tr>
<tr valign="top" class="even"><td ><tt>&lt;enableFullTextSearchFallback&gt;</tt></td><td >Enables or disables the ability to fallback and use the full text search if a keyword cannot be found in the index. This functionality can be used while remote controlling <i>Qt Assistant</i>. To make it available for remote control, set the tag value to <tt>true</tt>.</td></tr>
</table>
<p>In addition to those <i>Qt Assistant</i> specific tags, the tags for generating and registering documentation can be used. See Qt Help Collection Project documentation for more information.</p>
<p>An example of a help collection file that uses all the available tags is shown below:</p>
<pre class="cpp"><span class="operator">&lt;</span><span class="operator">?</span>xml version<span class="operator">=</span><span class="string">&quot;1.0&quot;</span> encoding<span class="operator">=</span><span class="string">&quot;utf-8&quot;</span> <span class="operator">?</span><span class="operator">&gt;</span>
<span class="operator">&lt;</span><span class="type">QHelpCollectionProject</span> version<span class="operator">=</span><span class="string">&quot;1.0&quot;</span><span class="operator">&gt;</span>
    <span class="operator">&lt;</span>assistant<span class="operator">&gt;</span>
        <span class="operator">&lt;</span>title<span class="operator">&gt;</span>My Application Help<span class="operator">&lt;</span><span class="operator">/</span>title<span class="operator">&gt;</span>
        <span class="operator">&lt;</span>startPage<span class="operator">&gt;</span>qthelp:<span class="comment">//com.mycompany.1_0_0/doc/index.html&lt;/startPage&gt;</span>
        <span class="operator">&lt;</span>currentFilter<span class="operator">&gt;</span>myfilter<span class="operator">&lt;</span><span class="operator">/</span>currentFilter<span class="operator">&gt;</span>
        <span class="operator">&lt;</span>applicationIcon<span class="operator">&gt;</span>application<span class="operator">.</span>png<span class="operator">&lt;</span><span class="operator">/</span>applicationIcon<span class="operator">&gt;</span>
        <span class="operator">&lt;</span>enableFilterFunctionality<span class="operator">&gt;</span><span class="keyword">false</span><span class="operator">&lt;</span><span class="operator">/</span>enableFilterFunctionality<span class="operator">&gt;</span>
        <span class="operator">&lt;</span>enableDocumentationManager<span class="operator">&gt;</span><span class="keyword">false</span><span class="operator">&lt;</span><span class="operator">/</span>enableDocumentationManager<span class="operator">&gt;</span>
        <span class="operator">&lt;</span>enableAddressBar visible<span class="operator">=</span><span class="string">&quot;true&quot;</span><span class="operator">&gt;</span><span class="keyword">true</span><span class="operator">&lt;</span><span class="operator">/</span>enableAddressBar<span class="operator">&gt;</span>
        <span class="operator">&lt;</span>cacheDirectory<span class="operator">&gt;</span>mycompany<span class="operator">/</span>myapplication<span class="operator">&lt;</span><span class="operator">/</span>cacheDirectory<span class="operator">&gt;</span>
        <span class="operator">&lt;</span>aboutMenuText<span class="operator">&gt;</span>
            <span class="operator">&lt;</span>text<span class="operator">&gt;</span>About My Application<span class="operator">&lt;</span><span class="operator">/</span>text<span class="operator">&gt;</span>
            <span class="operator">&lt;</span>text language<span class="operator">=</span><span class="string">&quot;de&quot;</span><span class="operator">&gt;</span>��ber meine Applikation<span class="operator">.</span><span class="operator">.</span><span class="operator">.</span><span class="operator">&lt;</span><span class="operator">/</span>text<span class="operator">&gt;</span>
        <span class="operator">&lt;</span><span class="operator">/</span>aboutMenuText<span class="operator">&gt;</span>
        <span class="operator">&lt;</span>aboutDialog<span class="operator">&gt;</span>
            <span class="operator">&lt;</span>file<span class="operator">&gt;</span>about<span class="operator">.</span>txt<span class="operator">&lt;</span><span class="operator">/</span>file<span class="operator">&gt;</span>
            <span class="operator">&lt;</span>file language<span class="operator">=</span><span class="string">&quot;de&quot;</span><span class="operator">&gt;</span>ueber<span class="operator">.</span>txt<span class="operator">&lt;</span><span class="operator">/</span>file<span class="operator">&gt;</span>
            <span class="operator">&lt;</span>icon<span class="operator">&gt;</span>about<span class="operator">.</span>png<span class="operator">&lt;</span><span class="operator">/</span>icon<span class="operator">&gt;</span>
        <span class="operator">&lt;</span><span class="operator">/</span>aboutDialog<span class="operator">&gt;</span>
    <span class="operator">&lt;</span><span class="operator">/</span>assistant<span class="operator">&gt;</span>
    <span class="operator">&lt;</span>docFiles<span class="operator">&gt;</span>
        <span class="operator">&lt;</span>generate<span class="operator">&gt;</span>
            <span class="operator">&lt;</span>file<span class="operator">&gt;</span>
                <span class="operator">&lt;</span>input<span class="operator">&gt;</span>myapplication<span class="operator">-</span>manual<span class="operator">.</span>qhp<span class="operator">&lt;</span><span class="operator">/</span>input<span class="operator">&gt;</span>
                <span class="operator">&lt;</span>output<span class="operator">&gt;</span>myapplication<span class="operator">-</span>manual<span class="operator">.</span>qch<span class="operator">&lt;</span><span class="operator">/</span>output<span class="operator">&gt;</span>
            <span class="operator">&lt;</span><span class="operator">/</span>file<span class="operator">&gt;</span>
        <span class="operator">&lt;</span><span class="operator">/</span>generate<span class="operator">&gt;</span>
        <span class="operator">&lt;</span><span class="keyword">register</span><span class="operator">&gt;</span>
            <span class="operator">&lt;</span>file<span class="operator">&gt;</span>myapplication<span class="operator">-</span>manual<span class="operator">.</span>qch<span class="operator">&lt;</span><span class="operator">/</span>file<span class="operator">&gt;</span>
        <span class="operator">&lt;</span><span class="operator">/</span><span class="keyword">register</span><span class="operator">&gt;</span>
    <span class="operator">&lt;</span><span class="operator">/</span>docFiles<span class="operator">&gt;</span>
<span class="operator">&lt;</span><span class="operator">/</span><span class="type">QHelpCollectionProject</span><span class="operator">&gt;</span></pre>
<p>To create the binary collection file, run the <tt>qcollectiongenerator</tt> tool:</p>
<pre class="cpp">qcollectiongenerator mycollection<span class="operator">.</span>qhcp <span class="operator">-</span>o mycollection<span class="operator">.</span>qhc</pre>
<p>To test the generated collection file, start <i>Qt Assistant</i> in the following way:</p>
<pre class="cpp">assistant <span class="operator">-</span>collectionFile mycollection<span class="operator">.</span>qhc</pre>
<a name="using-qt-assistant-remotely"></a>
<h2>Using Qt Assistant Remotely</h2>
<p>Even though the help viewer is a standalone application, it will mostly be launched by the application it provides help for. This approach gives the application the possibility to ask for specific help contents to be displayed as soon as the help viewer is started. Another advantage with this approach is that the application can communicate with the help viewer process and can therefore request other help contents to be shown depending on the current state of the application.</p>
<p>So, to use <i>Qt Assistant</i> as the custom help viewer of your application, simply create a QProcess and specify the path to the <i>Qt Assistant</i> executable. In order to make <i>Qt Assistant</i> listen to your application, turn on its remote control functionality by passing the <tt>-enableRemoteControl</tt> command line option.</p>
<p>The following example shows how this can be done:</p>
<pre class="cpp"><span class="type">QProcess</span> <span class="operator">*</span>process <span class="operator">=</span> <span class="keyword">new</span> <span class="type">QProcess</span>;
<span class="type">QStringList</span> args;
args <span class="operator">&lt;</span><span class="operator">&lt;</span> QLatin1String(<span class="string">&quot;-collectionFile&quot;</span>)
    <span class="operator">&lt;</span><span class="operator">&lt;</span> QLatin1String(<span class="string">&quot;mycollection.qhc&quot;</span>)
    <span class="operator">&lt;</span><span class="operator">&lt;</span> QLatin1String(<span class="string">&quot;-enableRemoteControl&quot;</span>);
process<span class="operator">-</span><span class="operator">&gt;</span>start(QLatin1String(<span class="string">&quot;assistant&quot;</span>)<span class="operator">,</span> args);
<span class="keyword">if</span> (<span class="operator">!</span>process<span class="operator">-</span><span class="operator">&gt;</span>waitForStarted())
    <span class="keyword">return</span>;</pre>
<p>Once <i>Qt Assistant</i> is running, you can send commands by using the stdin channel of the process. The code snippet below shows how to tell <i>Qt Assistant</i> to show a certain page in the documentation.</p>
<pre class="cpp"><span class="type">QByteArray</span> ba;
ba<span class="operator">.</span>append(<span class="string">&quot;setSource qthelp://com.mycompany.1_0_0/doc/index.html\n&quot;</span>);
process<span class="operator">-</span><span class="operator">&gt;</span>write(ba);</pre>
<p><b>Note: </b>The trailing newline character is required to mark the end of the input.</p><p>The following commands can be used to control <i>Qt Assistant</i>:</p>
<table class="generic">
 <thead><tr class="qt-style"><th >Command</th><th >Brief Description</th></tr></thead>
<tr valign="top" class="odd"><td ><tt>show &lt;Widget&gt;</tt></td><td >Shows the sidebar window (dock widget) specified by &lt;Widget&gt;. If the widget is already shown and this command is sent again, the widget will be activated, meaning that it will be raised and given the input focus. Possible values for &lt;Widget&gt; are &quot;contents&quot;, &quot;index&quot;, &quot;bookmarks&quot; or &quot;search&quot;.</td></tr>
<tr valign="top" class="even"><td ><tt>hide &lt;Widget&gt;</tt></td><td >Hides the dock widget specified by &lt;Widget&gt;. Possible values for &lt;Widget&gt; are &quot;contents&quot;, &quot;index&quot;, &quot;bookmarks&quot; and &quot;search&quot;.</td></tr>
<tr valign="top" class="odd"><td ><tt>setSource &lt;Url&gt;</tt></td><td >Displays the given &lt;Url&gt;. The URL can be absolute or relative to the currently displayed page. If the URL is absolute, it has to be a valid Qt help system URL. That is, starting with &quot;qthelp://&quot;.</td></tr>
<tr valign="top" class="even"><td ><tt>activateKeyword &lt;Keyword&gt;</tt></td><td >Inserts the specified &lt;Keyword&gt; into the line edit of the index dock widget and activates the corresponding item in the index list. If such an item has more than one link associated with it, a topic chooser will be shown.</td></tr>
<tr valign="top" class="odd"><td ><tt>activateIdentifier &lt;Id&gt;</tt></td><td >Displays the help contents for the given &lt;Id&gt;. An ID is unique in each namespace and has only one link associated to it, so the topic chooser will never pop up.</td></tr>
<tr valign="top" class="even"><td ><tt>syncContents</tt></td><td >Selects the item in the contents widget which corresponds to the currently displayed page.</td></tr>
<tr valign="top" class="odd"><td ><tt>setCurrentFilter &lt;filter&gt;</tt></td><td >Selects the specified filter and updates the visual representation accordingly.</td></tr>
<tr valign="top" class="even"><td ><tt>expandToc &lt;Depth&gt;</tt></td><td >Expands the table of contents tree to the given depth. If depth is 0, the tree will be collapsed completely. If depth is -1, the tree will be expanded completely.</td></tr>
<tr valign="top" class="odd"><td ><tt>register &lt;help file&gt;</tt></td><td >Adds the given Qt compressed help file to the collection.</td></tr>
<tr valign="top" class="even"><td ><tt>unregister &lt;help file&gt;</tt></td><td >Removes the given Qt compressed help file from the collection.</td></tr>
</table>
<p>If you want to send several commands within a short period of time, it is recommended that you write only a single line to the stdin of the process instead of one line for every command. The commands have to be separated by a semicolon, as shown in the following example:</p>
<pre class="cpp"><span class="type">QByteArray</span> ba;
ba<span class="operator">.</span>append(<span class="string">&quot;hide bookmarks;&quot;</span>);
ba<span class="operator">.</span>append(<span class="string">&quot;hide index;&quot;</span>);
ba<span class="operator">.</span>append(<span class="string">&quot;setSource qthelp://com.mycompany.1_0_0/doc/index.html\n&quot;</span>);
process<span class="operator">-</span><span class="operator">&gt;</span>write(ba);</pre>
<a name="compatibility-with-old-formats"></a>
<h2>Compatibility with Old Formats</h2>
<p>In Qt versions up to 4.3, the help system was based on Document Content File (DCF) and Qt Assistant Documentation Profile (ADP) formats. Unfortunately, the old file formats are not compatible with the new ones that are described in this manual and that are used from Qt 4.4 on, also in Qt 5. In general, the differences are not that big &mdash; in most cases is the old format is just a subset of the new one. One example is the <tt>namespace</tt> tag in the Qt Help Project format, which was not part of the old format, but plays a vital role in the new one. To help you to move to the new file format, we have created a conversion wizard.</p>
<p>The wizard is started by executing <tt>qhelpconverter</tt>. It guides you through the conversion of different parts of the file and generates a new <tt>qch</tt> or <tt>qhcp</tt> file.</p>
<p>Once the wizard is finished and the files created, run the <tt>qhelpgenerator</tt> or the <tt>qcollectiongenerator</tt> tool to generate the binary help files used by <i>Qt Assistant</i>.</p>
</div>
<!-- @@@assistant-custom-help-viewer.html -->
<p class="naviNextPrevious footerNavi">
<a class="prevPage" href="assistant-details.html">Using Qt Assistant</a>
</p>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2013 Digia Plc and/or its
   subsidiaries. Documentation contributions included herein are the copyrights of
   their respective owners.<br>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br>    Digia, Qt and their respective logos are trademarks of Digia Plc     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>