Qt Reference Documentation

Qt Examples

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 Examples 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 Tutorials, and then begin with the Application example.

The Qt Widget Gallery also provides overviews of selected Qt widgets in each of the styles used on various supported platforms.

Most examples are provided under the terms of the Modified BSD License. Some examples are however provided under the terms of the GNU LGPL version 2.1.

Qt Quick Example Code

The QML Examples and Demos site has a dedicated page for QML examples.

Qt Examples by Module or Technology

ActiveQt Examples

Using ActiveX from Qt applications.

Animation Framework Examples

Doing animations with Qt.

D-Bus Examples

Using D-Bus from Qt applications.

Desktop Examples

Integrating your Qt application with your favorite desktop.

Dialog Examples

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.

Embedded Platform Examples

Using Qt on small screens.

Gestures Examples

Gesture programming examples.

Graphics View 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 Examples

Inter-Process Communication with Qt.

Item Views Examples

Using the model/view design pattern to separate presentation from data.

Layout Examples

Using Qt's layout-based approach to widget management.

Main Window Examples

Building applications around a main window.

Multimedia Examples

Audio, video, and Phonon with Qt.

Network Examples

How to do network programming in Qt.

OpenGL Examples

Accessing OpenGL from Qt.

OpenVG Examples

Accessing OpenVG from Qt.

Painting Examples

How to use the Qt painting system.

PublishSubscribe Examples

Examples for the QtSystems - Publish Subscribe sub-module

Qt Bluetooth Examples

Examples for the QtBluetooth module

Qt Designer Examples

Using Qt Designer to build your UI.

Qt Linguist Examples

Using Qt Linguist to internationalize your Qt application.

Qt Location Examples

Examples for the Qt Location module

Qt Script Examples

Using the Qt scripting environment.

Qt Sensors Examples

Examples for the Qt Sensors module

Qt for Embedded Linux Examples

Using Qt in Embedded Linux.

QtQuick2::Qt Quick Code Samples

Building UIs with QML

Rich Text Examples

Using the document-oriented rich text engine.

SQL Examples

Accessing your SQL database from Qt.

ServiceFramework Examples

Examples for the QtSystems - Service Framework sub-module

State Machine Examples

Using Qt's finite state machine classes.

Threading and Concurrent Programming Examples

Threading and concurrent programming in Qt.

Tools Examples

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 Examples

Using XML with Qt.