1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
---|
4 | ** All rights reserved.
|
---|
5 | ** Contact: Nokia Corporation ([email protected])
|
---|
6 | **
|
---|
7 | ** This file is part of the documentation of the Qt Toolkit.
|
---|
8 | **
|
---|
9 | ** $QT_BEGIN_LICENSE:BSD$
|
---|
10 | ** You may use this file under the terms of the BSD license as follows:
|
---|
11 | **
|
---|
12 | ** "Redistribution and use in source and binary forms, with or without
|
---|
13 | ** modification, are permitted provided that the following conditions are
|
---|
14 | ** met:
|
---|
15 | ** * Redistributions of source code must retain the above copyright
|
---|
16 | ** notice, this list of conditions and the following disclaimer.
|
---|
17 | ** * Redistributions in binary form must reproduce the above copyright
|
---|
18 | ** notice, this list of conditions and the following disclaimer in
|
---|
19 | ** the documentation and/or other materials provided with the
|
---|
20 | ** distribution.
|
---|
21 | ** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
|
---|
22 | ** the names of its contributors may be used to endorse or promote
|
---|
23 | ** products derived from this software without specific prior written
|
---|
24 | ** permission.
|
---|
25 | **
|
---|
26 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
---|
27 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
---|
28 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
---|
29 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
---|
30 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
---|
31 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
---|
32 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
33 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
34 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
35 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
---|
36 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
---|
37 | ** $QT_END_LICENSE$
|
---|
38 | **
|
---|
39 | ****************************************************************************/
|
---|
40 |
|
---|
41 | //! [0]
|
---|
42 | #include <QtHelp>
|
---|
43 | //! [0]
|
---|
44 |
|
---|
45 |
|
---|
46 | //! [1]
|
---|
47 | CONFIG += help
|
---|
48 | //! [1]
|
---|
49 |
|
---|
50 |
|
---|
51 | //! [2]
|
---|
52 | qhelpgenerator doc.qhp -o doc.qch
|
---|
53 | //! [2]
|
---|
54 |
|
---|
55 |
|
---|
56 | //! [3]
|
---|
57 | <?xml version="1.0" encoding="utf-8" ?>
|
---|
58 | <QHelpCollectionProject version="1.0">
|
---|
59 | <docFiles>
|
---|
60 | <register>
|
---|
61 | <file>doc.qch</file>
|
---|
62 | </register>
|
---|
63 | </docFiles>
|
---|
64 | </QHelpCollectionProject>
|
---|
65 | //! [3]
|
---|
66 |
|
---|
67 |
|
---|
68 | //! [4]
|
---|
69 | qcollectiongenerator mycollection.qhcp -o mycollection.qhc
|
---|
70 | //! [4]
|
---|
71 |
|
---|
72 |
|
---|
73 | //! [5]
|
---|
74 | ...
|
---|
75 | <docFiles>
|
---|
76 | <generate>
|
---|
77 | <file>
|
---|
78 | <input>doc.qhp</input>
|
---|
79 | <output>doc.qch</output>
|
---|
80 | </file>
|
---|
81 | </generate>
|
---|
82 | <register>
|
---|
83 | <file>doc.qch</file>
|
---|
84 | </register>
|
---|
85 | </docFiles>
|
---|
86 | ...
|
---|
87 | //! [5]
|
---|
88 |
|
---|
89 |
|
---|
90 | //! [6]
|
---|
91 | QHelpEngineCore helpEngine("mycollection.qhc");
|
---|
92 | ...
|
---|
93 |
|
---|
94 | // get all file references for the identifier
|
---|
95 | QMap<QString, QUrl> links =
|
---|
96 | helpEngine.linksForIdentifier(QLatin1String("MyDialog::ChangeButton"));
|
---|
97 |
|
---|
98 | // If help is available for this keyword, get the help data
|
---|
99 | // of the first file reference.
|
---|
100 | if (links.count()) {
|
---|
101 | QByteArray helpData = helpEngine->fileData(links.constBegin().value());
|
---|
102 | // show the documentation to the user
|
---|
103 | if (!helpData.isEmpty())
|
---|
104 | displayHelp(helpData);
|
---|
105 | }
|
---|
106 | //! [6]
|
---|
107 |
|
---|
108 |
|
---|
109 | //! [7]
|
---|
110 | <?xml version="1.0" encoding="UTF-8"?>
|
---|
111 | <QtHelpProject version="1.0">
|
---|
112 | <namespace>mycompany.com.myapplication.1.0</namespace>
|
---|
113 | <virtualFolder>doc</virtualFolder>
|
---|
114 | <customFilter name="My Application 1.0">
|
---|
115 | <filterAttribute>myapp</filterAttribute>
|
---|
116 | <filterAttribute>1.0</filterAttribute>
|
---|
117 | </customFilter>
|
---|
118 | <filterSection>
|
---|
119 | <filterAttribute>myapp</filterAttribute>
|
---|
120 | <filterAttribute>1.0</filterAttribute>
|
---|
121 | <toc>
|
---|
122 | <section title="My Application Manual" ref="index.html">
|
---|
123 | <section title="Chapter 1" ref="doc.html#chapter1"/>
|
---|
124 | <section title="Chapter 2" ref="doc.html#chapter2"/>
|
---|
125 | <section title="Chapter 3" ref="doc.html#chapter3"/>
|
---|
126 | </section>
|
---|
127 | </toc>
|
---|
128 | <keywords>
|
---|
129 | <keyword name="foo" id="MyApplication::foo" ref="doc.html#foo"/>
|
---|
130 | <keyword name="bar" ref="doc.html#bar"/>
|
---|
131 | <keyword id="MyApplication::foobar" ref="doc.html#foobar"/>
|
---|
132 | </keywords>
|
---|
133 | <files>
|
---|
134 | <file>classic.css</file>
|
---|
135 | <file>*.html</file>
|
---|
136 | </files>
|
---|
137 | </filterSection>
|
---|
138 | </QtHelpProject>
|
---|
139 | //! [7]
|
---|
140 |
|
---|
141 |
|
---|
142 | //! [8]
|
---|
143 | ...
|
---|
144 | <virtualFolder>doc</virtualFolder>
|
---|
145 | ...
|
---|
146 | //! [8]
|
---|
147 |
|
---|
148 |
|
---|
149 | //! [9]
|
---|
150 | ...
|
---|
151 | <customFilter name="My Application 1.0">
|
---|
152 | <filterAttribute>myapp</filterAttribute>
|
---|
153 | <filterAttribute>1.0</filterAttribute>
|
---|
154 | </customFilter>
|
---|
155 | ...
|
---|
156 | //! [9]
|
---|
157 |
|
---|
158 |
|
---|
159 | //! [10]
|
---|
160 | ...
|
---|
161 | <filterSection>
|
---|
162 | <filterAttribute>myapp</filterAttribute>
|
---|
163 | <filterAttribute>1.0</filterAttribute>
|
---|
164 | ...
|
---|
165 | //! [10]
|
---|
166 |
|
---|
167 |
|
---|
168 | //! [11]
|
---|
169 | ...
|
---|
170 | <toc>
|
---|
171 | <section title="My Application Manual" ref="index.html">
|
---|
172 | <section title="Chapter 1" ref="doc.html#chapter1"/>
|
---|
173 | <section title="Chapter 2" ref="doc.html#chapter2"/>
|
---|
174 | <section title="Chapter 3" ref="doc.html#chapter3"/>
|
---|
175 | </section>
|
---|
176 | </toc>
|
---|
177 | ...
|
---|
178 | //! [11]
|
---|
179 |
|
---|
180 |
|
---|
181 | //! [12]
|
---|
182 | ...
|
---|
183 | <keywords>
|
---|
184 | <keyword name="foo" id="MyApplication::foo" ref="doc.html#foo"/>
|
---|
185 | <keyword name="bar" ref="doc.html#bar"/>
|
---|
186 | <keyword id="MyApplication::foobar" ref="doc.html#foobar"/>
|
---|
187 | </keywords>
|
---|
188 | ...
|
---|
189 | //! [12]
|
---|
190 |
|
---|
191 |
|
---|
192 | //! [13]
|
---|
193 | ...
|
---|
194 | <files>
|
---|
195 | <file>classic.css</file>
|
---|
196 | <file>*.html</file>
|
---|
197 | </files>
|
---|
198 | ...
|
---|
199 | //! [13]
|
---|