Qt 范例

Qt includes a set of examples that cover nearly every aspect of Qt development. They aren't meant to be impressive when you run them, but in each case the source code has been carefully written to illustrate one or more best Qt programming practices.

You can run the examples from the Examples and Demos Launcher application (except see QML 范例 for special instructions for running those examples). In addition, Qt Creator can directly run these examples through the Welcome Page.

The examples are listed below by functional area. Each example listed in a particular functional area is meant to illustrate how best to use Qt to do some particular task in that functional area, but the examples will often use features from other functional areas as well for completeness.

If you are new to Qt, you should probably start by going through the 教程 , and then begin with the 应用程序 范例。

In addition to these examples and the 教程 , Qt includes a selection of demos that deliberately show off Qt's features. You might want to look at these as well.

These examples are provided under the terms of the Modified BSD License .

Qt Quick Example Code

The QML 范例和演示 site has a dedicated page for QML examples.

Qt Mobility Example Code

The Qt Mobility Examples page lists examples that show how the Qt Mobility APIs might be used.

Qt Examples by Module or Technology

ActiveQt 范例 Using ActiveX from Qt applications.
动画框架范例 Doing animations with Qt.
D-Bus 范例 Using D-Bus from Qt applications.
桌面范例 Integrating your Qt application with your favorite desktop.
对话框范例 Using Qt's standard dialogs and building and using custom dialogs.
Drag and Drop Examples How to access your platform's native drag and drop functionality.
Gestures Examples Gesture programming examples.
图形视图范例 Using Qt to manage and interact with a large (potentially) number of graphics items.
Help System Examples Adding interactive help to your Qt application.
IPC (进程间通信) 范例 Inter-Process Communication with Qt.
项视图范例 Using the model/view design pattern to separate presentation from data.
布局范例 Using Qt's layout-based approach to widget management.
主窗口范例 Building applications around a main window.
Multimedia Examples Audio, video, and Phonon with Qt.
网络范例 How to do network programming in Qt.
OpenGL Examples Accessing OpenGL from Qt.
OpenVG Examples Accessing OpenVG from Qt.
描绘范例 How to use the Qt painting system.
QML 范例和演示 Building UIs with QML
Qt Designer 范例 Using Qt Designer to build your UI.
Qt Linguist 范例 Using Qt Linguist to internationalize your Qt application.
Qt Script Examples Using the Qt scripting environment.
Qt for Embedded Linux Examples Using Qt in Embedded Linux.
富文本范例 Using the document-oriented rich text engine.
SQL 范例 Accessing your SQL database from Qt.
State Machine Examples Using Qt's finite state machine classes.
线程和并发编程范例 Threading and concurrent programming in Qt.
工具范例 Using Qt's containers, iterators, and other tool classes.
Touch Input Examples Using Qt's touch input capability.
UiTools Examples Using the QtUiTools module.
WebKit Examples Using WebKit in your Qt application.
Widget Examples Lots of examples of how to use different kinds of widgets.
XML 范例 Using XML with Qt.