repos
/
doc
/ annotate_shade
summary
|
shortlog
|
log
|
tree
|
commit
|
commitdiff
|
headdiff
|
annotate
|
headblob
|
headfilediff
|
filehistory
normal
|
plain
|
shade
|
zebra
phonon & :arg0
Annotate for file qt.xml
2009-04-05 tobias
1
<?xml version="1.0"?>
17:58:25 '
2
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
'
3
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
'
4
<chapter id="qt">
'
5
<title>Qt</title>
'
6
<para>
2009-07-22 tobias
7
Besides the <package>:qt</package> there are these modules: with
2009-04-05 tobias
8
<itemizedlist>
2009-08-30 tobias
9
<listitem><para>
14:26:13 '
10
<package>:qt.uitools</package>
'
11
<ulink url="http://doc.trolltech.com/4.5/qtuitools.html">
'
12
QtUiTools</ulink></para></listitem>
'
13
<listitem><para><package>:qt.test</package>
'
14
<ulink url="http://doc.trolltech.com/4.5/qttest.html">
'
15
QtTest</ulink></para></listitem>
'
16
<listitem><para><package>:qt.webkit</package>
'
17
<ulink url="http://doc.trolltech.com/4.5/qtwebkit.html">
'
18
QtWebKit</ulink>
'
19
</para></listitem>
2009-07-22 tobias
20
<listitem><para><package>:qt.phonon</package>
22:53:41 '
21
<ulink url="http://doc.trolltech.com/4.5/phonon.html">
'
22
Phonon</ulink>
'
23
</para></listitem>
2009-04-05 tobias
24
</itemizedlist>
2009-07-22 tobias
25
which provide bindings for their Qt module. The class names of this modules are in
22:53:41 '
26
the <package>:qt</package> package. (E.g. Phonon::VideoPlayer is <code>'qt:phonon.video-player</code>
'
27
and QTest is <code>'qt:test</code>)
'
28
</para>
'
29
<para>
2010-01-10 tobias
30
Additionally there is the <package>:qt.tests</package> system, containing
08:57:54 '
31
the unit tests and <package>:qt.examples</package> for various examples.
2009-04-05 tobias
32
</para>
17:58:25 '
33
2009-07-06 tobias
34
<section id="qapplication"><title>qt:application</title>
2009-04-05 tobias
35
<para>
17:58:25 '
36
The <classname>qt:application</classname> object should created with:
2009-04-07 tobias
37
<macro>qt:with-app</macro>. In its body the event loop can be
2009-04-05 tobias
38
started with <methodname>qt:exec</methodname>.
17:58:25 '
39
</para>
'
40
<example>
'
41
<title>Hello World</title>
'
42
<screenshot>
'
43
<mediaobject>
'
44
<imageobject>
2009-08-30 tobias
45
<imagedata fileref="hello-world.png" format="PNG"/>
2009-04-05 tobias
46
</imageobject>
17:58:25 '
47
</mediaobject>
'
48
</screenshot>
'
49
<programlisting language="lisp">
'
50
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="../qt.examples/src/hello-world.lisp" parse="text" />
2009-08-30 tobias
51
</programlisting>
2009-04-05 tobias
52
</example>
2009-06-03 tobias
53
<para>
22:31:34 '
54
Subclasses of <classname>qt:paint-device</classname> (e.g. <classname>qt:widget</classname>) can only be used when
'
55
a <classname>qt:application</classname> instance exists. When there are, for example, <classname>qt:widget</classname> instances
'
56
at the end of <macro>qt:with-app</macro>, they are deleted by the <classname>qt:application</classname> destructor.
'
57
</para>
2009-06-04 tobias
58
<section><title>Interactive Development</title>
21:20:49 '
59
<para>
'
60
The <package>:cl-smoke.repl</package> allows you to start a <classname>qt:application</classname> event loop in the background for
'
61
interactive development in SLIME.
'
62
To start the event loop use <methodname>cl-smoke.repl:start-event-loop-in-background</methodname> (or
'
63
<methodname>cl-smoke.repl:start-event-loop-in-repl</methodname>).
'
64
<footnote>
'
65
<para>
'
66
Currently <code>START-EVENT-LOOP-IN-BACKGROUND</code> is recommended.
'
67
</para>
'
68
</footnote>
'
69
As long as you do not kill the thread or unwind over a foreign function, you should be fine.
'
70
</para>
'
71
</section>
2009-04-05 tobias
72
</section>
17:58:25 '
73
2009-07-06 tobias
74
<section id="signal_slot"><title>Signal-Slot</title>
2009-04-05 tobias
75
<para>
2009-04-07 tobias
76
<genericfunction>qt:connect</genericfunction> connects a signal to a slot.
2009-04-05 tobias
77
The signal is either a <classname>qt:qsignal</classname> created with
17:58:25 '
78
<methodname>qt:make-signal</methodname> or a C++ signal by using
'
79
<methodname>qt:get-signal</methodname>.
'
80
The slot can be a slot returned by <classname>qt:make-slot</classname>, a function
'
81
or a C++ slot a return from <methodname>qt:get-slot</methodname>.
'
82
</para>
'
83
<example><title>Quit</title>
2009-06-05 tobias
84
<programlisting language="lisp">
2009-04-05 tobias
85
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="../qt.examples/src/hello-world-quit.lisp" parse="text" />
17:58:25 '
86
</programlisting>
'
87
</example>
'
88
<para>
'
89
When the argument types for a slot or signal are not specified they are determined when
'
90
the first connection is made. Note that when connecting a <classname>qt:qsignal</classname>
2009-06-04 tobias
91
to a <classname>qt:qslot</classname> at least one must have its arguments types specified. Type specifier <code>T</code>
21:20:49 '
92
allows to pass a Lisp object as is from a Lisp signal to a Lisp slot.
2009-04-05 tobias
93
</para>
17:58:25 '
94
'
95
<para>
'
96
The functionality of the Qt <code>SIGNAL</code> and <code>SLOT</code> macros is
'
97
provided by <methodname>qt:qsignal</methodname> and <methodname>qt:qslot</methodname>.
'
98
</para>
'
99
</section>
'
100
2009-07-06 tobias
101
<section id="properties"><title>Properties</title>
2009-04-05 tobias
102
<para>
17:58:25 '
103
<classname>qt:object</classname> properties can be accessed with
'
104
<methodname>qt:property</methodname> (setf-able).
'
105
The name of the property can be either a string in C++ style or a symbol in Lisp style.
2009-07-22 tobias
106
The predefined Qt properties can be accessed with symbols in the keyword package.
2009-04-05 tobias
107
</para>
17:58:25 '
108
<informalexample>
2009-06-05 tobias
109
<programlisting language="lisp">
2009-04-05 tobias
110
(let ((object (make-instance '<classname>qt:object</classname>)))
2009-07-22 tobias
111
(setf (<methodname>qt:property</methodname> object :object-name) "Foo")
2009-08-30 tobias
112
(assert (string= "Foo" (<methodname>qt:property</methodname> object "objectName"))))
2009-04-05 tobias
113
</programlisting>
17:58:25 '
114
</informalexample>
'
115
'
116
</section>
'
117
2009-07-06 tobias
118
<section id="variant"><title>Variant</title>
2009-04-12 tobias
119
<para>
2009-05-11 tobias
120
A <classname>qt:variant</classname> can be constructed with <methodname>qt:make-variant</methodname>
2009-04-12 tobias
121
or to pass a Lisp object with <methodname>qt:make-lisp-variant</methodname>.
2009-05-11 tobias
122
Its value is returned by <genericfunction>qt:value</genericfunction>.
2009-04-12 tobias
123
</para>
20:56:16 '
124
</section>
2009-04-05 tobias
125
2009-07-06 tobias
126
<section id="i18n"><title>i18n</title>
2009-04-05 tobias
127
<para>
17:58:25 '
128
You can use <methodname>qt:tr</methodname> to translate strings.
'
129
</para>
'
130
<example>
'
131
<title>i18n Hello World</title>
'
132
<screenshot>
'
133
<mediaobject>
'
134
<imageobject>
2009-08-30 tobias
135
<imagedata fileref="i18n-hello-world.png" format="PNG"/>
2009-04-05 tobias
136
</imageobject>
17:58:25 '
137
</mediaobject>
'
138
</screenshot>
'
139
2009-06-05 tobias
140
<programlisting language="lisp">
2009-04-05 tobias
141
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
17:58:25 '
142
href="../qt.examples/src/i18n-hello-world.lisp" parse="text" />
2009-08-30 tobias
143
</programlisting>
2009-04-05 tobias
144
17:58:25 '
145
<formalpara>
'
146
<title><filename>hello-world_de.po</filename></title>
'
147
<para>
'
148
<programlisting language="po">
'
149
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="../qt.examples/src/hello-world_de.po" parse="text" />
2009-08-30 tobias
150
</programlisting>
2009-04-05 tobias
151
</para>
17:58:25 '
152
</formalpara>
'
153
</example>
'
154
'
155
<para>
'
156
Gettext is used to extract the i18n strings and compile the message catalog.
'
157
See <filename><ulink url="../qt.examples/src/CMakeLists.txt">CMakeLists.txt</ulink></filename>
'
158
and <filename><ulink url="../qt.examples/src/UseClQti18n.cmake">UseClQti18n.cmake</ulink></filename>
2010-01-10 tobias
159
in the <filename class="directory">src/</filename> directory of <package>:qt.examples</package> on how to do this.
2009-04-05 tobias
160
</para>
17:58:25 '
161
</section>
'
162
2009-07-06 tobias
163
<section id="qt_examples"><title>Examples</title>
2009-04-05 tobias
164
<para>
17:58:25 '
165
You can run the examples with:
2009-06-05 tobias
166
<programlisting language="lisp">
2010-01-10 tobias
167
(mb:load <package>:qt.examples</package>)
2009-04-07 tobias
168
(<methodname>qt.examples:launcher</methodname>)
2009-04-05 tobias
169
</programlisting>
17:58:25 '
170
</para>
'
171
'
172
<example>
'
173
<title>Repl</title>
'
174
<para>
'
175
Use a <classname>qt:string-list-model</classname> with a <classname>qt:list-view</classname>
'
176
to show evaluated lisp expressions.
'
177
</para>
'
178
<screenshot>
'
179
<mediaobject>
'
180
<imageobject>
2009-08-30 tobias
181
<imagedata fileref="repl.png" format="PNG"/>
2009-04-05 tobias
182
</imageobject>
17:58:25 '
183
</mediaobject>
'
184
</screenshot>
'
185
<programlisting language="lisp">
'
186
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="../qt.examples/src/repl.lisp" parse="text" />
2009-08-30 tobias
187
</programlisting>
2009-04-05 tobias
188
</example>
17:58:25 '
189
'
190
<example>
'
191
<title>Class Browser</title>
2010-01-10 tobias
192
<para>Qt Classes browser using <package>:qt.webkit</package> to display the
2009-04-05 tobias
193
API doc and a custom <classname>qt:list-model</classname>
17:58:25 '
194
for the <classname>qt:list-view</classname> of the available classes.
'
195
</para>
'
196
<screenshot>
'
197
<mediaobject>
'
198
<imageobject>
2009-08-30 tobias
199
<imagedata fileref="class-browser.png" format="PNG"/>
2009-04-05 tobias
200
</imageobject>
17:58:25 '
201
</mediaobject>
'
202
</screenshot>
'
203
<programlisting language="lisp">
'
204
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="../qt.examples/src/class-browser.lisp" parse="text" />
2009-08-30 tobias
205
</programlisting>
2009-04-05 tobias
206
</example>
17:58:25 '
207
'
208
</section>
'
209
2009-07-06 tobias
210
<section id="opengl"><title>OpenGL</title>
21:51:20 '
211
<para>
2009-12-13 tobias
212
For OpenGL an binding is needed (e.g.:
2009-07-06 tobias
213
<ulink url="http://common-lisp.net/project/cl-opengl/">cl-opengl</ulink>).
21:51:20 '
214
</para>
'
215
<example><title>Origami</title>
'
216
<para>
'
217
<ulink url="http://tobias.rautenkranz.ch/darcsweb/darcsweb.cgi?r=cl-smoke/qt.examples;a=tree;f=/src/origami">Origami</ulink>
'
218
draws a pleated hyperbolic paraboloid using the method described in
'
219
<ulink url="http://arxiv.org/abs/0906.4747">(Non)existence of Pleated Folds: How Paper Folds Between Creases</ulink>
'
220
</para>
'
221
<mediaobject>
'
222
<videoobject>
'
223
<videodata fileref='origami.ogg'/>
'
224
</videoobject>
'
225
</mediaobject>
'
226
<para>
'
227
<note>
'
228
<para>
2009-12-13 tobias
229
Because <ulink url="http://common-lisp.net/project/cl-opengl/">cl-opengl</ulink> is need to
13:22:09 '
230
run the example, but is not in mudballs; the origami example is not included in the mudballs system.
'
231
<ulink url="http://axiom-wiki.newsynthesis.org/FrontPage">Axiom</ulink> is needed for building.
2009-07-06 tobias
232
</para>
21:51:20 '
233
</note>
'
234
</para>
'
235
</example>
'
236
</section>
'
237
2009-12-13 tobias
238
<section id="commonqt"><title>CommonQt</title>
13:22:09 '
239
<para><ulink url="http://tobias.rautenkranz.ch/darcsweb/darcsweb.cgi?r=cl-smoke/commonqt">:cl-smoke.commonqt</ulink>
'
240
is an experimental compatibility layer to run Lisp code using the
'
241
<ulink url="http://common-lisp.net/project/commonqt/">CommonQt</ulink> API with cl-smoke.
'
242
It is incomplete, but implementing the missing pieces should be straight forward.
'
243
</para>
'
244
<screenshot>
'
245
<mediaobject>
'
246
<imageobject>
2009-08-30 tobias
247
<imagedata fileref="commonqt-t14.png" format="PNG"/>
2009-12-13 tobias
248
</imageobject>
13:22:09 '
249
<caption>
'
250
<para>CommonQt tutorial 14
'
251
<filename><ulink url="http://repo.or.cz/w/commonqt.git?a=blob;f=tutorial/t14.lisp;hb=HEAD">t14.lisp</ulink></filename>
'
252
running with <code>:cl-smoke.commonqt</code>.
'
253
</para>
'
254
</caption>
'
255
</mediaobject>
'
256
</screenshot>
'
257
</section>
'
258
2009-04-05 tobias
259
</chapter>