summaryrefslogtreecommitdiffstats
path: root/examples/README
blob: eaf566bf5850e5610947b29e908b0d3981862d49 (plain)
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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
This examples directory contains lots of Qt examples. And there are
additional examples in ../tools/designer/examples/ and in the
extensions subdirectories. The documentation contains two detailed Qt
tutorials and additional tutorials for Qt Designer. The examples here
are useful for learning particular Qt classes and techniques, but to
learn Qt itself we recommend starting with the documentation's short
"How to Learn Qt" document.

It is best to run each example from its own directory since some of
them assume they are run from there.


aclock
    This example displays an analog clock widget.
    It shows how to create a custom widget (QWidget subclass) and how
    to create a timer using QTimer.

action
    A single document interface application example with a menu bar,
    tool bar and status bar that provides simple text editing.
    It shows how to implement a typical modern application, how to
    create a QMainWindow subclass, and how to create actions that can
    be assigned to menus (QPopupMenu) and toolbars (QToolBar) using
    QAction. It also shows how to print using QSimpleRichText.

addressbook [obsolete]

application [obsolete; see the action example instead]

biff [Unix-specific]
    Biff is a simple graphical program to indicate whether there is
    new mail; it looks like xbiff but is much shorter.

buttongroups
    This examples shows different types of group boxes (QButtonGroup,
    and QGroupBox), and different kinds of buttons (QCheckBox,
    QRadioButton, and QPushButton). It also shows how to add a
    QPopupMenu to a button.

canvas
    This examples demonstrates many of QCanvasView's facilities, but
    by no means all of them. It uses QCanvasItem, QCanvasLine,
    QCanvasRectangle, QCanvasEllipse, QCanvasSprite, and of course
    QCanvas.

chart
    An application for maintaining simple numeric data and visualising
    the data using pie and bar charts.
    Tutorial #2 explains this application in detail.
    
checklists
    Shows two list views with check box and radio button items. (These
    kinds of lists are often used with setup programs.)
    Shows the use of QListView, QListViewItem, QCheckListItem,
    QListViewItemIterator, and QValueList.

cursor
    This example shows how to set the mouse cursor for a widget. Shows
    Qt's cursors and a custom cursor using QLabel and QCursor.

customlayout
    This examples demonstrates how to write a customized layout
    (geometry) manager, like a Card-Layout, Border-Layout and
    Flow-Layout.

dclock
    This example displays a digital LCD clock and can switch between
    time and date.
    It uses the QLCDNumber widget and a couple of QTimers.

demo
    Run this to see almost all of Qt's widgets in action, including
    drag and drop, 2D graphics, etc.

desktop
    The desktop demo contains three routines, each of which draws
    something on the desktop. It does some nice stuff with QPainter,
    and also demonstrates how one can treat the desktop as a widget
    like any other.

directpainter [Qt/Embedded-specific]
    Shows the use of QDirectPainter.

dirview
    This example program demonstrates how to use a QListView and
    QListViewItems to build a multi-column hierarchical, memory- and
    CPU-efficient directory browser. It also demonstrates how to use
    Drag'n'Drop in a QListview. (See also the fileiconview example.)

distributor
    This is a utility program that can be used to modify the paths
    used in the Qt library binary to make the binary suitable for
    distribution. For experts only.

dragdrop
    Demonstrates image and text drag and drop.

drawdemo
    Draws a color wheel, text and shapes. This example demonstrates
    several drawing functions and printer output using QPainter,
    QWMatrix, QFont, QFontMetrics, QColor, QBrush, and QPrinter. You
    can easily add you own drawing functions. See "ourDrawFunctions".

drawlines
    This example shows very simple mouse-based user interaction and
    painting without any world transform matrix or other advanced
    features. Run the program, click the button, move the mouse,
    release the button, and watch the lines get drawn.

extension
    An extension dialog with simple and advanced appearances
    controlled by a toggle button.

fileiconview
    This example partially implements a very basic file manager using
    a widget derived from QIconView to display the current directory.
    It uses the DirectoryView widget from the dirview example to
    display the directory tree.
    It also shows how to add a QComboBox to a QToolBar and how to
    implement a context menu using QPopupMenu.

fonts [obsolete; see the qfd example instead]

forever
    WARNING: this program has a strobe effect.
    See how fast Qt can draw colored rectangles. This example
    continuously draws rectangles in a window and has another widget
    that counts the number of rectangles that are drawn per second.

gridview
    A QGridView with 100x100 cells.

hello
    Hello world with colored animated wavy text.

helpdemo
    Shows how to use Qt Assistant as an application's online help
    tool. (See also the helpsystem example.)

helpsystem
    This example shows how to implement context-sensitive help in
    various ways in a Qt application using QToolTip, QWhatsThis, and
    QAssistantClient to control Qt Assistant.

helpviewer
    The HelpViewer example implements a simple HTML help browser using
    Qt's richtext capabilities.

i18n
    This example shows how to internationalize applications. Start it with
  	./i18n en
    to run the application in English, and with
  	./i18n de
    to run it in German. Other languages are also available including,
    Arabic (ar), French (fr), Italian (it), Japanese (jp), Korean
    (ko), Norwegian (no), and Russian (ru). Some languages depend on
    the availability of suitable fonts.

iconview
    This example implements a flexible icon view which can store lots
    of icon items. It supports Drag'n'Drop and different selection
    modes using QIconView.

kiosk [Qt/Embedded-specific]
    An MPEG player.

launcher [Qt/Embedded-specific]
    A program launcher.

layout [obsolete]
    This example shows simple and intermediate use of Qt's layout
    classes, QGridLaout, QBoxLayout etc.

life
    An implementation of the life game with a Unix-flavor GUI. 

lineedits
    This example shows how to use various properties of QLineEdit
    including echo modes, input masks, and validators.

listbox
    Shows QListBox options.

listboxcombo
    This example shows how to use QListBox (with single selection and
    multi selection) and QComboBox (editable and non-editable).

listviews
    This examples shows how to work with QListView (a tree view
    widget)

mdi
    Similar to the action example, but this time using MDI (Multiple
    Document Interface). It subclasses QMainWindow and uses the
    QWorkspace class to provide MDI and shows how to implement an MDI
    Window menu.

menu
    This example demonstrates the simple use of menus (a menu bar and
    pull-down menus), and a context menu. (See also the popup
    example.)

movies
    The Movies example displays animated GIF files using the QMovie
    and QLabel classes.

network/archivesearch
    Shows how to use QHttp to request and receive data from a web
    site.

network/clientserver
    Provides a client application and a server application that
    communicate using QSocket and QServerSocket.

network/ftpclient
    A simple FTP client that uses QFtp to retrieve directory listings
    and to download and upload files.

network/httpd
    An extremely simple HTTP daemon built using QServerSocket.

network/infoprotocol
    A more complex client/server example.

network/mail
    A simple mail client that can send email using the QSocket class.

network/networkprotocol
    A simple implementation of a subset of the NNTP protocol. This
    shows how to implement your own network protocols by subclassing
    QNetworkProtocol.

network/remotecontrol
    Controlling one application from another using QSocket-based IPC.

opengl/box
    Shows how to use OpenGL in Qt using QGLWidget.

opengl/gear
    Shows how to build OpenGL display lists.

opengl/glpixmap
    This is based on the box example. It shows how to render an OpenGL
    scene into a QPixmap.

opengl/overlay
    Demonstrates the use of OpenGL overlays (where supported).

opengl/sharedbox
    Demonstrates how to share OpenGL display lists with QGLWidgets.

opengl/texture
    Shows how to use OpenGL textures.

picture
    This example shows how to make, store to file, and read back, a
    picture as a set of vector drawing commands.

popup
    This examples shows how to implement popup widgets.

process
    Shows how to execute a non-GUI application in a separate process
    with I/O redirection.

progress
    WARNING: this program has a strobe effect.
    This example presents a long-running process (drawing lots of
    rectangles) and a QProgressDialog. Two types of progress dialog
    are offered, one that simply shows text, and a custom one that
    shows an animation using a QLabel and a QTimer.

progressbar
    Shows how to use a QProgressBar.

qdir
    Shows how to use and customize QFileDialog. Run
  	qdir --help
    for details. Also shows QFileInfo.

qfd
    This example program displays all the characters of a selected
    font. It shows the use of QFontDialog, QFontMetrics and QFontInfo,
    and a QTable subclass.

qmag
    This is a simple magnifier-type program. It shows how one can do
    some tquite low-level operations portably using Qt.

qwerty
    Simple text editor for testing different character encodings.

rangecontrols
    This examples shows how to use QSpinBox and QSlider.

regexptester
    This little application is useful for testing regular expressions.

richtext
    This example shows the use of QTextView (a read/only QTextEdit
    subclass).

rot13
    A simple implementation of the rot13 algorithm.

scribble
    An implementation of the well known scribble program. You can draw
    with different pen colors and widths and save the result as a
    pixmap in various formats. It shows how to do drawing using a
    QWidget subclass (rather than a QCanvas for example). It also
    shows how to add a QSpinBox to a QToolBar and how to implement a
    button that pops up a menu (using QPushButton and QPopupMenu), and
    also how to use the QColorDialog.

scrollview
    This example shows one way of using a QScrollview. This widget is
    highly optimized for showing very large contents including child
    widgets.

showimg
    This example reads and displays an image in any supported image
    format (GIF, BMP, PPM, XMP, etc.)

sound
    Shows how to play sounds from a Qt application (and how to see if
    sound is supported) using QSound.

splitter
    This example shows how to use QSplitter to give the user control
    over how much vertical or horizontal space is given to child
    widgets.

sql/blob
    Shows how to connect to a database and how to write to and read
    BLOB fields (for those databases that support BLOBs).

sql/overview [to be withdrawn]
    This is just a series of tiny examples used by the SQL module
    overview (sql.html).

sql/sqltable
    A very simple example that shows how to relate a database table to
    a QDataTable.

tabdialog
    This example shows how to use a dialog with multiple tabs (pages).
    It shows the use of QTabDialog and QFileInfo.

table/bigtable
    This shows how to create a sparse very large (1M x 1M cells)
    QTable by avoiding the use of table items.

table/small-table-demo
    A small, simple QTable example that uses QTableItems to show text
    and pixmaps, and QComboTableItems and QCheckTableItems to show how
    they work.

table/statistics
    A QTable example that shows how to subclass QTableItem.

tablet
    This shows how to interact with a tablet device. It will only run
    if a compatible tablet is installed.

tetrix
    This is the Qt implementation of the well known game Tetris, but
    with an unusual twist, not to mention a comment that's almost a
    work of art.

textedit
    A simple text editor based on QTextEdit.

themes
    This examples demonstrates how to draw widgets in different styles
    (themes). Example themes looking like wood and metal are
    implemented. You can switch between the different styles at
    runtime using the menu. Shows how to create a QStyle subclass. Not
    for the faint-hearted.

tictac
    This is an implementation of the Tic-Tac-Toe game.

tooltip
    This example widget demonstrates how to use tool tips for static
    and dynamic regions within a widget using a QToolTip subclass.

toplevel
    This program allows you to set all the flags for a widget and then
    displays the widget using the flags.

trayicon [work in progress]

tux
    Shows how to create a non-rectangular window.

widgets
    Shows many Qt widgets (See also the demo example).

wizard
    This example shows how to use QWizard.

xform
    Demonstrates how to arbitrarily rotate, shear and scale text and
    graphics using QWMatrix.

xml/outliner
    Shows how to read in an XML file using Qt's DOM classes and
    display the data in a list view.

xml/tagreader
    Shows how to read an XML file using Qt's SAX classes.

xml/tagreader-with-features
    Shows how to read an XML file using Qt's SAX classes, and displays
    the data showing the effects of different feature settings.