1 | This examples directory contains lots of Qt examples. And there are
|
---|
2 | additional examples in ../tools/designer/examples/ and in the
|
---|
3 | extensions subdirectories. The documentation contains two detailed Qt
|
---|
4 | tutorials and additional tutorials for Qt Designer. The examples here
|
---|
5 | are useful for learning particular Qt classes and techniques, but to
|
---|
6 | learn Qt itself we recommend starting with the documentation's short
|
---|
7 | "How to Learn Qt" document.
|
---|
8 |
|
---|
9 | It is best to run each example from its own directory since some of
|
---|
10 | them assume they are run from there.
|
---|
11 |
|
---|
12 |
|
---|
13 | aclock
|
---|
14 | This example displays an analog clock widget.
|
---|
15 | It shows how to create a custom widget (QWidget subclass) and how
|
---|
16 | to create a timer using QTimer.
|
---|
17 |
|
---|
18 | action
|
---|
19 | A single document interface application example with a menu bar,
|
---|
20 | tool bar and status bar that provides simple text editing.
|
---|
21 | It shows how to implement a typical modern application, how to
|
---|
22 | create a QMainWindow subclass, and how to create actions that can
|
---|
23 | be assigned to menus (QPopupMenu) and toolbars (QToolBar) using
|
---|
24 | QAction. It also shows how to print using QSimpleRichText.
|
---|
25 |
|
---|
26 | addressbook [obsolete]
|
---|
27 |
|
---|
28 | application [obsolete; see the action example instead]
|
---|
29 |
|
---|
30 | biff [Unix-specific]
|
---|
31 | Biff is a simple graphical program to indicate whether there is
|
---|
32 | new mail; it looks like xbiff but is much shorter.
|
---|
33 |
|
---|
34 | buttongroups
|
---|
35 | This examples shows different types of group boxes (QButtonGroup,
|
---|
36 | and QGroupBox), and different kinds of buttons (QCheckBox,
|
---|
37 | QRadioButton, and QPushButton). It also shows how to add a
|
---|
38 | QPopupMenu to a button.
|
---|
39 |
|
---|
40 | canvas
|
---|
41 | This examples demonstrates many of QCanvasView's facilities, but
|
---|
42 | by no means all of them. It uses QCanvasItem, QCanvasLine,
|
---|
43 | QCanvasRectangle, QCanvasEllipse, QCanvasSprite, and of course
|
---|
44 | QCanvas.
|
---|
45 |
|
---|
46 | chart
|
---|
47 | An application for maintaining simple numeric data and visualising
|
---|
48 | the data using pie and bar charts.
|
---|
49 | Tutorial #2 explains this application in detail.
|
---|
50 |
|
---|
51 | checklists
|
---|
52 | Shows two list views with check box and radio button items. (These
|
---|
53 | kinds of lists are often used with setup programs.)
|
---|
54 | Shows the use of QListView, QListViewItem, QCheckListItem,
|
---|
55 | QListViewItemIterator, and QValueList.
|
---|
56 |
|
---|
57 | cursor
|
---|
58 | This example shows how to set the mouse cursor for a widget. Shows
|
---|
59 | Qt's cursors and a custom cursor using QLabel and QCursor.
|
---|
60 |
|
---|
61 | customlayout
|
---|
62 | This examples demonstrates how to write a customized layout
|
---|
63 | (geometry) manager, like a Card-Layout, Border-Layout and
|
---|
64 | Flow-Layout.
|
---|
65 |
|
---|
66 | dclock
|
---|
67 | This example displays a digital LCD clock and can switch between
|
---|
68 | time and date.
|
---|
69 | It uses the QLCDNumber widget and a couple of QTimers.
|
---|
70 |
|
---|
71 | demo
|
---|
72 | Run this to see almost all of Qt's widgets in action, including
|
---|
73 | drag and drop, 2D graphics, etc.
|
---|
74 |
|
---|
75 | desktop
|
---|
76 | The desktop demo contains three routines, each of which draws
|
---|
77 | something on the desktop. It does some nice stuff with QPainter,
|
---|
78 | and also demonstrates how one can treat the desktop as a widget
|
---|
79 | like any other.
|
---|
80 |
|
---|
81 | directpainter [Qt/Embedded-specific]
|
---|
82 | Shows the use of QDirectPainter.
|
---|
83 |
|
---|
84 | dirview
|
---|
85 | This example program demonstrates how to use a QListView and
|
---|
86 | QListViewItems to build a multi-column hierarchical, memory- and
|
---|
87 | CPU-efficient directory browser. It also demonstrates how to use
|
---|
88 | Drag'n'Drop in a QListview. (See also the fileiconview example.)
|
---|
89 |
|
---|
90 | distributor
|
---|
91 | This is a utility program that can be used to modify the paths
|
---|
92 | used in the Qt library binary to make the binary suitable for
|
---|
93 | distribution. For experts only.
|
---|
94 |
|
---|
95 | dragdrop
|
---|
96 | Demonstrates image and text drag and drop.
|
---|
97 |
|
---|
98 | drawdemo
|
---|
99 | Draws a color wheel, text and shapes. This example demonstrates
|
---|
100 | several drawing functions and printer output using QPainter,
|
---|
101 | QWMatrix, QFont, QFontMetrics, QColor, QBrush, and QPrinter. You
|
---|
102 | can easily add you own drawing functions. See "ourDrawFunctions".
|
---|
103 |
|
---|
104 | drawlines
|
---|
105 | This example shows very simple mouse-based user interaction and
|
---|
106 | painting without any world transform matrix or other advanced
|
---|
107 | features. Run the program, click the button, move the mouse,
|
---|
108 | release the button, and watch the lines get drawn.
|
---|
109 |
|
---|
110 | extension
|
---|
111 | An extension dialog with simple and advanced appearances
|
---|
112 | controlled by a toggle button.
|
---|
113 |
|
---|
114 | fileiconview
|
---|
115 | This example partially implements a very basic file manager using
|
---|
116 | a widget derived from QIconView to display the current directory.
|
---|
117 | It uses the DirectoryView widget from the dirview example to
|
---|
118 | display the directory tree.
|
---|
119 | It also shows how to add a QComboBox to a QToolBar and how to
|
---|
120 | implement a context menu using QPopupMenu.
|
---|
121 |
|
---|
122 | fonts [obsolete; see the qfd example instead]
|
---|
123 |
|
---|
124 | forever
|
---|
125 | WARNING: this program has a strobe effect.
|
---|
126 | See how fast Qt can draw colored rectangles. This example
|
---|
127 | continuously draws rectangles in a window and has another widget
|
---|
128 | that counts the number of rectangles that are drawn per second.
|
---|
129 |
|
---|
130 | gridview
|
---|
131 | A QGridView with 100x100 cells.
|
---|
132 |
|
---|
133 | hello
|
---|
134 | Hello world with colored animated wavy text.
|
---|
135 |
|
---|
136 | helpdemo
|
---|
137 | Shows how to use Qt Assistant as an application's online help
|
---|
138 | tool. (See also the helpsystem example.)
|
---|
139 |
|
---|
140 | helpsystem
|
---|
141 | This example shows how to implement context-sensitive help in
|
---|
142 | various ways in a Qt application using QToolTip, QWhatsThis, and
|
---|
143 | QAssistantClient to control Qt Assistant.
|
---|
144 |
|
---|
145 | helpviewer
|
---|
146 | The HelpViewer example implements a simple HTML help browser using
|
---|
147 | Qt's richtext capabilities.
|
---|
148 |
|
---|
149 | i18n
|
---|
150 | This example shows how to internationalize applications. Start it with
|
---|
151 | ./i18n en
|
---|
152 | to run the application in English, and with
|
---|
153 | ./i18n de
|
---|
154 | to run it in German. Other languages are also available including,
|
---|
155 | Arabic (ar), French (fr), Italian (it), Japanese (jp), Korean
|
---|
156 | (ko), Norwegian (no), and Russian (ru). Some languages depend on
|
---|
157 | the availability of suitable fonts.
|
---|
158 |
|
---|
159 | iconview
|
---|
160 | This example implements a flexible icon view which can store lots
|
---|
161 | of icon items. It supports Drag'n'Drop and different selection
|
---|
162 | modes using QIconView.
|
---|
163 |
|
---|
164 | kiosk [Qt/Embedded-specific]
|
---|
165 | An MPEG player.
|
---|
166 |
|
---|
167 | launcher [Qt/Embedded-specific]
|
---|
168 | A program launcher.
|
---|
169 |
|
---|
170 | layout [obsolete]
|
---|
171 | This example shows simple and intermediate use of Qt's layout
|
---|
172 | classes, QGridLaout, QBoxLayout etc.
|
---|
173 |
|
---|
174 | life
|
---|
175 | An implementation of the life game with a Unix-flavor GUI.
|
---|
176 |
|
---|
177 | lineedits
|
---|
178 | This example shows how to use various properties of QLineEdit
|
---|
179 | including echo modes, input masks, and validators.
|
---|
180 |
|
---|
181 | listbox
|
---|
182 | Shows QListBox options.
|
---|
183 |
|
---|
184 | listboxcombo
|
---|
185 | This example shows how to use QListBox (with single selection and
|
---|
186 | multi selection) and QComboBox (editable and non-editable).
|
---|
187 |
|
---|
188 | listviews
|
---|
189 | This examples shows how to work with QListView (a tree view
|
---|
190 | widget)
|
---|
191 |
|
---|
192 | mdi
|
---|
193 | Similar to the action example, but this time using MDI (Multiple
|
---|
194 | Document Interface). It subclasses QMainWindow and uses the
|
---|
195 | QWorkspace class to provide MDI and shows how to implement an MDI
|
---|
196 | Window menu.
|
---|
197 |
|
---|
198 | menu
|
---|
199 | This example demonstrates the simple use of menus (a menu bar and
|
---|
200 | pull-down menus), and a context menu. (See also the popup
|
---|
201 | example.)
|
---|
202 |
|
---|
203 | movies
|
---|
204 | The Movies example displays animated GIF files using the QMovie
|
---|
205 | and QLabel classes.
|
---|
206 |
|
---|
207 | network/archivesearch
|
---|
208 | Shows how to use QHttp to request and receive data from a web
|
---|
209 | site.
|
---|
210 |
|
---|
211 | network/clientserver
|
---|
212 | Provides a client application and a server application that
|
---|
213 | communicate using QSocket and QServerSocket.
|
---|
214 |
|
---|
215 | network/ftpclient
|
---|
216 | A simple FTP client that uses QFtp to retrieve directory listings
|
---|
217 | and to download and upload files.
|
---|
218 |
|
---|
219 | network/httpd
|
---|
220 | An extremely simple HTTP daemon built using QServerSocket.
|
---|
221 |
|
---|
222 | network/infoprotocol
|
---|
223 | A more complex client/server example.
|
---|
224 |
|
---|
225 | network/mail
|
---|
226 | A simple mail client that can send email using the QSocket class.
|
---|
227 |
|
---|
228 | network/networkprotocol
|
---|
229 | A simple implementation of a subset of the NNTP protocol. This
|
---|
230 | shows how to implement your own network protocols by subclassing
|
---|
231 | QNetworkProtocol.
|
---|
232 |
|
---|
233 | network/remotecontrol
|
---|
234 | Controlling one application from another using QSocket-based IPC.
|
---|
235 |
|
---|
236 | opengl/box
|
---|
237 | Shows how to use OpenGL in Qt using QGLWidget.
|
---|
238 |
|
---|
239 | opengl/gear
|
---|
240 | Shows how to build OpenGL display lists.
|
---|
241 |
|
---|
242 | opengl/glpixmap
|
---|
243 | This is based on the box example. It shows how to render an OpenGL
|
---|
244 | scene into a QPixmap.
|
---|
245 |
|
---|
246 | opengl/overlay
|
---|
247 | Demonstrates the use of OpenGL overlays (where supported).
|
---|
248 |
|
---|
249 | opengl/sharedbox
|
---|
250 | Demonstrates how to share OpenGL display lists with QGLWidgets.
|
---|
251 |
|
---|
252 | opengl/texture
|
---|
253 | Shows how to use OpenGL textures.
|
---|
254 |
|
---|
255 | picture
|
---|
256 | This example shows how to make, store to file, and read back, a
|
---|
257 | picture as a set of vector drawing commands.
|
---|
258 |
|
---|
259 | popup
|
---|
260 | This examples shows how to implement popup widgets.
|
---|
261 |
|
---|
262 | process
|
---|
263 | Shows how to execute a non-GUI application in a separate process
|
---|
264 | with I/O redirection.
|
---|
265 |
|
---|
266 | progress
|
---|
267 | WARNING: this program has a strobe effect.
|
---|
268 | This example presents a long-running process (drawing lots of
|
---|
269 | rectangles) and a QProgressDialog. Two types of progress dialog
|
---|
270 | are offered, one that simply shows text, and a custom one that
|
---|
271 | shows an animation using a QLabel and a QTimer.
|
---|
272 |
|
---|
273 | progressbar
|
---|
274 | Shows how to use a QProgressBar.
|
---|
275 |
|
---|
276 | qdir
|
---|
277 | Shows how to use and customize QFileDialog. Run
|
---|
278 | qdir --help
|
---|
279 | for details. Also shows QFileInfo.
|
---|
280 |
|
---|
281 | qfd
|
---|
282 | This example program displays all the characters of a selected
|
---|
283 | font. It shows the use of QFontDialog, QFontMetrics and QFontInfo,
|
---|
284 | and a QTable subclass.
|
---|
285 |
|
---|
286 | qmag
|
---|
287 | This is a simple magnifier-type program. It shows how one can do
|
---|
288 | some quite low-level operations portably using Qt.
|
---|
289 |
|
---|
290 | qwerty
|
---|
291 | Simple text editor for testing different character encodings.
|
---|
292 |
|
---|
293 | rangecontrols
|
---|
294 | This examples shows how to use QSpinBox and QSlider.
|
---|
295 |
|
---|
296 | regexptester
|
---|
297 | This little application is useful for testing regular expressions.
|
---|
298 |
|
---|
299 | richtext
|
---|
300 | This example shows the use of QTextView (a read/only QTextEdit
|
---|
301 | subclass).
|
---|
302 |
|
---|
303 | rot13
|
---|
304 | A simple implementation of the rot13 algorithm.
|
---|
305 |
|
---|
306 | scribble
|
---|
307 | An implementation of the well known scribble program. You can draw
|
---|
308 | with different pen colors and widths and save the result as a
|
---|
309 | pixmap in various formats. It shows how to do drawing using a
|
---|
310 | QWidget subclass (rather than a QCanvas for example). It also
|
---|
311 | shows how to add a QSpinBox to a QToolBar and how to implement a
|
---|
312 | button that pops up a menu (using QPushButton and QPopupMenu), and
|
---|
313 | also how to use the QColorDialog.
|
---|
314 |
|
---|
315 | scrollview
|
---|
316 | This example shows one way of using a QScrollview. This widget is
|
---|
317 | highly optimized for showing very large contents including child
|
---|
318 | widgets.
|
---|
319 |
|
---|
320 | showimg
|
---|
321 | This example reads and displays an image in any supported image
|
---|
322 | format (GIF, BMP, PPM, XMP, etc.)
|
---|
323 |
|
---|
324 | sound
|
---|
325 | Shows how to play sounds from a Qt application (and how to see if
|
---|
326 | sound is supported) using QSound.
|
---|
327 |
|
---|
328 | splitter
|
---|
329 | This example shows how to use QSplitter to give the user control
|
---|
330 | over how much vertical or horizontal space is given to child
|
---|
331 | widgets.
|
---|
332 |
|
---|
333 | sql/blob
|
---|
334 | Shows how to connect to a database and how to write to and read
|
---|
335 | BLOB fields (for those databases that support BLOBs).
|
---|
336 |
|
---|
337 | sql/overview [to be withdrawn]
|
---|
338 | This is just a series of tiny examples used by the SQL module
|
---|
339 | overview (sql.html).
|
---|
340 |
|
---|
341 | sql/sqltable
|
---|
342 | A very simple example that shows how to relate a database table to
|
---|
343 | a QDataTable.
|
---|
344 |
|
---|
345 | tabdialog
|
---|
346 | This example shows how to use a dialog with multiple tabs (pages).
|
---|
347 | It shows the use of QTabDialog and QFileInfo.
|
---|
348 |
|
---|
349 | table/bigtable
|
---|
350 | This shows how to create a sparse very large (1M x 1M cells)
|
---|
351 | QTable by avoiding the use of table items.
|
---|
352 |
|
---|
353 | table/small-table-demo
|
---|
354 | A small, simple QTable example that uses QTableItems to show text
|
---|
355 | and pixmaps, and QComboTableItems and QCheckTableItems to show how
|
---|
356 | they work.
|
---|
357 |
|
---|
358 | table/statistics
|
---|
359 | A QTable example that shows how to subclass QTableItem.
|
---|
360 |
|
---|
361 | tablet
|
---|
362 | This shows how to interact with a tablet device. It will only run
|
---|
363 | if a compatible tablet is installed.
|
---|
364 |
|
---|
365 | tetrix
|
---|
366 | This is the Qt implementation of the well known game Tetris, but
|
---|
367 | with an unusual twist, not to mention a comment that's almost a
|
---|
368 | work of art.
|
---|
369 |
|
---|
370 | textedit
|
---|
371 | A simple text editor based on QTextEdit.
|
---|
372 |
|
---|
373 | themes
|
---|
374 | This examples demonstrates how to draw widgets in different styles
|
---|
375 | (themes). Example themes looking like wood and metal are
|
---|
376 | implemented. You can switch between the different styles at
|
---|
377 | runtime using the menu. Shows how to create a QStyle subclass. Not
|
---|
378 | for the faint-hearted.
|
---|
379 |
|
---|
380 | tictac
|
---|
381 | This is an implementation of the Tic-Tac-Toe game.
|
---|
382 |
|
---|
383 | tooltip
|
---|
384 | This example widget demonstrates how to use tool tips for static
|
---|
385 | and dynamic regions within a widget using a QToolTip subclass.
|
---|
386 |
|
---|
387 | toplevel
|
---|
388 | This program allows you to set all the flags for a widget and then
|
---|
389 | displays the widget using the flags.
|
---|
390 |
|
---|
391 | trayicon [work in progress]
|
---|
392 |
|
---|
393 | tux
|
---|
394 | Shows how to create a non-rectangular window.
|
---|
395 |
|
---|
396 | widgets
|
---|
397 | Shows many Qt widgets (See also the demo example).
|
---|
398 |
|
---|
399 | wizard
|
---|
400 | This example shows how to use QWizard.
|
---|
401 |
|
---|
402 | xform
|
---|
403 | Demonstrates how to arbitrarily rotate, shear and scale text and
|
---|
404 | graphics using QWMatrix.
|
---|
405 |
|
---|
406 | xml/outliner
|
---|
407 | Shows how to read in an XML file using Qt's DOM classes and
|
---|
408 | display the data in a list view.
|
---|
409 |
|
---|
410 | xml/tagreader
|
---|
411 | Shows how to read an XML file using Qt's SAX classes.
|
---|
412 |
|
---|
413 | xml/tagreader-with-features
|
---|
414 | Shows how to read an XML file using Qt's SAX classes, and displays
|
---|
415 | the data showing the effects of different feature settings.
|
---|
416 |
|
---|