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.
tqt3/examples/README

408 lines
13 KiB

This examples directory contains lots of TQt 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 TQt Designer. The examples here
are useful for learning particular TQt classes and techniques, but to
learn TQt 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 (TQWidget subclass) and how
to create a timer using TQTimer.
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 TQMainWindow subclass, and how to create actions that can
be assigned to menus (TQPopupMenu) and toolbars (TQToolBar) using
TQAction. It also shows how to print using TQSimpleRichText.
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 (TQButtonGroup,
and TQGroupBox), and different kinds of buttons (TQCheckBox,
TQRadioButton, and TQPushButton). It also shows how to add a
TQPopupMenu to a button.
canvas
This examples demonstrates many of TQCanvasView's facilities, but
by no means all of them. It uses TQCanvasItem, TQCanvasLine,
TQCanvasRectangle, TQCanvasEllipse, TQCanvasSprite, and of course
TQCanvas.
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 TQListView, TQListViewItem, TQCheckListItem,
TQListViewItemIterator, and TQValueList.
cursor
This example shows how to set the mouse cursor for a widget. Shows
Qt's cursors and a custom cursor using TQLabel and TQCursor.
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 TQLCDNumber widget and a couple of TQTimers.
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 TQPainter,
and also demonstrates how one can treat the desktop as a widget
like any other.
dirview
This example program demonstrates how to use a TQListView and
TQListViewItems to build a multi-column hierarchical, memory- and
CPU-efficient directory browser. It also demonstrates how to use
Drag'n'Drop in a TQListview. (See also the fileiconview example.)
distributor
This is a utility program that can be used to modify the paths
used in the TQt 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 TQPainter,
TQWMatrix, TQFont, TQFontMetrics, TQColor, TQBrush, and TQPrinter. 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 TQIconView 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 TQComboBox to a TQToolBar and how to
implement a context menu using TQPopupMenu.
fonts [obsolete; see the qfd example instead]
forever
WARNING: this program has a strobe effect.
See how fast TQt 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 TQGridView with 100x100 cells.
hello
Hello world with colored animated wavy text.
helpdemo
Shows how to use TQt 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 TQt application using TQToolTip, TQWhatsThis, and
TQAssistantClient to control TQt 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 TQIconView.
layout [obsolete]
This example shows simple and intermediate use of Qt's layout
classes, TQGridLaout, TQBoxLayout etc.
life
An implementation of the life game with a Unix-flavor GUI.
lineedits
This example shows how to use various properties of TQLineEdit
including echo modes, input masks, and validators.
listbox
Shows TQListBox options.
listboxcombo
This example shows how to use TQListBox (with single selection and
multi selection) and TQComboBox (editable and non-editable).
listviews
This examples shows how to work with TQListView (a tree view
widget)
mdi
Similar to the action example, but this time using MDI (Multiple
Document Interface). It subclasses TQMainWindow and uses the
TQWorkspace 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 TQMovie
and TQLabel classes.
network/archivesearch
Shows how to use TQHttp to request and receive data from a web
site.
network/clientserver
Provides a client application and a server application that
communicate using TQSocket and TQServerSocket.
network/ftpclient
A simple FTP client that uses TQFtp to retrieve directory listings
and to download and upload files.
network/httpd
An extremely simple HTTP daemon built using TQServerSocket.
network/infoprotocol
A more complex client/server example.
network/mail
A simple mail client that can send email using the TQSocket class.
network/networkprotocol
A simple implementation of a subset of the NNTP protocol. This
shows how to implement your own network protocols by subclassing
TQNetworkProtocol.
network/remotecontrol
Controlling one application from another using TQSocket-based IPC.
opengl/box
Shows how to use OpenGL in TQt using TQGLWidget.
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 TQPixmap.
opengl/overlay
Demonstrates the use of OpenGL overlays (where supported).
opengl/sharedbox
Demonstrates how to share OpenGL display lists with TQGLWidgets.
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 TQProgressDialog. Two types of progress dialog
are offered, one that simply shows text, and a custom one that
shows an animation using a TQLabel and a TQTimer.
progressbar
Shows how to use a TQProgressBar.
tqdir
Shows how to use and customize TQFileDialog. Run
tqdir --help
for details. Also shows TQFileInfo.
qfd
This example program displays all the characters of a selected
font. It shows the use of TQFontDialog, TQFontMetrics and TQFontInfo,
and a TQTable 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 TQSpinBox and TQSlider.
regexptester
This little application is useful for testing regular expressions.
richtext
This example shows the use of TQTextView (a read/only TQTextEdit
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
TQWidget subclass (rather than a TQCanvas for example). It also
shows how to add a TQSpinBox to a TQToolBar and how to implement a
button that pops up a menu (using TQPushButton and TQPopupMenu), and
also how to use the TQColorDialog.
scrollview
This example shows one way of using a TQScrollview. 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 TQt application (and how to see if
sound is supported) using TQSound.
splitter
This example shows how to use TQSplitter 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 TQDataTable.
tabdialog
This example shows how to use a dialog with multiple tabs (pages).
It shows the use of TQTabDialog and TQFileInfo.
table/bigtable
This shows how to create a sparse very large (1M x 1M cells)
TQTable by avoiding the use of table items.
table/small-table-demo
A small, simple TQTable example that uses TQTableItems to show text
and pixmaps, and TQComboTableItems and TQCheckTableItems to show how
they work.
table/statistics
A TQTable example that shows how to subclass TQTableItem.
tablet
This shows how to interact with a tablet device. It will only run
if a compatible tablet is installed.
tetrix
This is the TQt 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 TQTextEdit.
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 TQStyle 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 TQToolTip 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 TQt widgets (See also the demo example).
wizard
This example shows how to use TQWizard.
xform
Demonstrates how to arbitrarily rotate, shear and scale text and
graphics using TQWMatrix.
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.