|
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 //! [0] |
|
43 #include <QtHelp> |
|
44 //! [0] |
|
45 |
|
46 |
|
47 //! [1] |
|
48 CONFIG += help |
|
49 //! [1] |
|
50 |
|
51 |
|
52 //! [2] |
|
53 qhelpgenerator doc.qhp -o doc.qch |
|
54 //! [2] |
|
55 |
|
56 |
|
57 //! [3] |
|
58 <?xml version="1.0" encoding="utf-8" ?> |
|
59 <QHelpCollectionProject version="1.0"> |
|
60 <docFiles> |
|
61 <register> |
|
62 <file>doc.qch</file> |
|
63 </register> |
|
64 </docFiles> |
|
65 </QHelpCollectionProject> |
|
66 //! [3] |
|
67 |
|
68 |
|
69 //! [4] |
|
70 qcollectiongenerator mycollection.qhcp -o mycollection.qhc |
|
71 //! [4] |
|
72 |
|
73 |
|
74 //! [5] |
|
75 ... |
|
76 <docFiles> |
|
77 <generate> |
|
78 <file> |
|
79 <input>doc.qhp</input> |
|
80 <output>doc.qch</output> |
|
81 </file> |
|
82 </generate> |
|
83 <register> |
|
84 <file>doc.qch</file> |
|
85 </register> |
|
86 </docFiles> |
|
87 ... |
|
88 //! [5] |
|
89 |
|
90 |
|
91 //! [6] |
|
92 QHelpEngineCore helpEngine("mycollection.qhc"); |
|
93 ... |
|
94 |
|
95 // get all file references for the identifier |
|
96 QMap<QString, QUrl> links = |
|
97 helpEngine.linksForIdentifier(QLatin1String("MyDialog::ChangeButton")); |
|
98 |
|
99 // If help is available for this keyword, get the help data |
|
100 // of the first file reference. |
|
101 if (links.count()) { |
|
102 QByteArray helpData = helpEngine->fileData(links.constBegin().value()); |
|
103 // show the documentation to the user |
|
104 if (!helpData.isEmpty()) |
|
105 displayHelp(helpData); |
|
106 } |
|
107 //! [6] |
|
108 |
|
109 |
|
110 //! [7] |
|
111 <?xml version="1.0" encoding="UTF-8"?> |
|
112 <QtHelpProject version="1.0"> |
|
113 <namespace>mycompany.com.myapplication.1.0</namespace> |
|
114 <virtualFolder>doc</virtualFolder> |
|
115 <customFilter name="My Application 1.0"> |
|
116 <filterAttribute>myapp</filterAttribute> |
|
117 <filterAttribute>1.0</filterAttribute> |
|
118 </customFilter> |
|
119 <filterSection> |
|
120 <filterAttribute>myapp</filterAttribute> |
|
121 <filterAttribute>1.0</filterAttribute> |
|
122 <toc> |
|
123 <section title="My Application Manual" ref="index.html"> |
|
124 <section title="Chapter 1" ref="doc.html#chapter1"/> |
|
125 <section title="Chapter 2" ref="doc.html#chapter2"/> |
|
126 <section title="Chapter 3" ref="doc.html#chapter3"/> |
|
127 </section> |
|
128 </toc> |
|
129 <keywords> |
|
130 <keyword name="foo" id="MyApplication::foo" ref="doc.html#foo"/> |
|
131 <keyword name="bar" ref="doc.html#bar"/> |
|
132 <keyword id="MyApplication::foobar" ref="doc.html#foobar"/> |
|
133 </keywords> |
|
134 <files> |
|
135 <file>classic.css</file> |
|
136 <file>*.html</file> |
|
137 </files> |
|
138 </filterSection> |
|
139 </QtHelpProject> |
|
140 //! [7] |
|
141 |
|
142 |
|
143 //! [8] |
|
144 ... |
|
145 <virtualFolder>doc</virtualFolder> |
|
146 ... |
|
147 //! [8] |
|
148 |
|
149 |
|
150 //! [9] |
|
151 ... |
|
152 <customFilter name="My Application 1.0"> |
|
153 <filterAttribute>myapp</filterAttribute> |
|
154 <filterAttribute>1.0</filterAttribute> |
|
155 </customFilter> |
|
156 ... |
|
157 //! [9] |
|
158 |
|
159 |
|
160 //! [10] |
|
161 ... |
|
162 <filterSection> |
|
163 <filterAttribute>myapp</filterAttribute> |
|
164 <filterAttribute>1.0</filterAttribute> |
|
165 ... |
|
166 //! [10] |
|
167 |
|
168 |
|
169 //! [11] |
|
170 ... |
|
171 <toc> |
|
172 <section title="My Application Manual" ref="index.html"> |
|
173 <section title="Chapter 1" ref="doc.html#chapter1"/> |
|
174 <section title="Chapter 2" ref="doc.html#chapter2"/> |
|
175 <section title="Chapter 3" ref="doc.html#chapter3"/> |
|
176 </section> |
|
177 </toc> |
|
178 ... |
|
179 //! [11] |
|
180 |
|
181 |
|
182 //! [12] |
|
183 ... |
|
184 <keywords> |
|
185 <keyword name="foo" id="MyApplication::foo" ref="doc.html#foo"/> |
|
186 <keyword name="bar" ref="doc.html#bar"/> |
|
187 <keyword id="MyApplication::foobar" ref="doc.html#foobar"/> |
|
188 </keywords> |
|
189 ... |
|
190 //! [12] |
|
191 |
|
192 |
|
193 //! [13] |
|
194 ... |
|
195 <files> |
|
196 <file>classic.css</file> |
|
197 <file>*.html</file> |
|
198 </files> |
|
199 ... |
|
200 //! [13] |