source: trunk/doc/src/snippets/code/doc_src_qthelp.qdoc@ 651

Last change on this file since 651 was 651, checked in by Dmitry A. Kuminov, 15 years ago

trunk: Merged in qt 4.6.2 sources.

File size: 5.2 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2010 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:LGPL$
10** Commercial Usage
11** Licensees holding valid Qt Commercial licenses may use this file in
12** accordance with the Qt Commercial License Agreement provided with the
13** Software or, alternatively, in accordance with the terms contained in
14** a written agreement between you and Nokia.
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** GNU General Public License Usage
29** Alternatively, this file may be used under the terms of the GNU
30** General Public License version 3.0 as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL included in the
32** packaging of this file. Please review the following information to
33** ensure the GNU General Public License version 3.0 requirements will be
34** met: http://www.gnu.org/copyleft/gpl.html.
35**
36** If you have questions regarding the use of this file, please contact
37** Nokia at [email protected].
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42//! [0]
43#include <QtHelp>
44//! [0]
45
46
47//! [1]
48CONFIG += help
49//! [1]
50
51
52//! [2]
53qhelpgenerator 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]
70qcollectiongenerator 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]
92QHelpEngineCore helpEngine("mycollection.qhc");
93...
94
95// get all file references for the identifier
96QMap<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.
101if (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]
Note: See TracBrowser for help on using the repository browser.