You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
qt3/examples/README

417 lines
13 KiB

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 quite 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.