Qt Examples And Tutorials▲
A collection of code samples and tutorials are provided with Qt to help new users get started with Qt development. These documents cover a range of topics, from basic use of widgets to step-by-step tutorials that show how an application is put together.
The examples are part of the Qt packages. Visit the Downloads page for more information.
Running the Examples▲
Open and run examples within Qt Creator's Welcome mode. Most of the examples run on various platforms and to search for platform-specific examples, type the platform name (or any keywords) in the search field. For example, typing Android in the search field lists the examples that are fully compatible with Android.
For more information about running examples in Qt Creator, visit the Building and Running an Example page.
Application Examples▲
-
Calqlatr: A Qt Quick app designed for portrait devices that uses custom components, animated with AnimationController, and JavaScript for the application logic.
-
Coffee Machine: A Qt Quick application with a state-based custom user interface.
-
Dice: A dice throwing application that demonstrates using Qt Quick 3D Physics and Qt Quick 3D.
-
Document Viewer: A Widgets application to display and print Json, text and PDF files. Demonstrates various features to use in widget applications: Using QSettings, query and save user preferences, manage file histories and control cursor behavior when hovering over widgets.
-
FX & Material Showroom: Demonstrates material and effects capabilities of Qt Quick 3D. This example demonstrates how you can use particle effects and materials in Qt Quick 3D.
-
Media Player Example: Playing audio and video using Qt Quick.
-
Photo Surface: A QML app for touch devices that uses a Repeater with a FolderListModel to access content in a folder, and a PinchHandler to handle pinch gestures on the fetched content.
-
Qt Quick Demo - RESTful Color Palette API client: Example of how to create a RESTful API QML client.
-
Robot Arm Example: Demonstrates how to add a C++ backend to a 3D project from Qt Design Studio. This example demonstrates adding a C++ backend to a 3D project created in Qt Design Studio. The example itself consists of an interactive industrial robot arm in a Qt Quick 3D scene. The 2D UI to control the robot arm is implement using Qt Quick Controls.
-
Thermostat: A user interface for a home thermostat, implemented in Qt Quick. It demonstrates how to create responsive applications that scale from large desktop displays to mobile and small embedded displays.
-
To Do List Example: A QML implementation of to do list application that demonstrates how to create application thats looks native on any platform.
Desktop▲
-
COM App Example (ActiveQt): The COM App example shows how to use ActiveQt to develop a Qt application that can be automated via COM. Different QObject based classes are exposed as COM objects that communicate with the GUI of the running Qt application. The APIs of those COM objects has been designed to resemble the APIs of standard COM applications; i.e. those from Microsoft Office.
-
Media Player Example: Playing audio and video using Qt Quick.
-
Qutlook Example (ActiveQt): The Qutlook example demonstrates the use of ActiveQt to automate Outlook. The example makes use of the dumpcpp tool to generate a C++ namespace for the type library describing the Outlook Object Model.
-
Simple Example (ActiveQt): The Simple example demonstrates the use of QAxBindable and QAxFactory.
-
System Tray Icon Example: The System Tray Icon example shows how to add an icon with a menu and popup messages to a desktop environment's system tray.
-
Taking a Screenshot: The Screenshot example shows how to take a screenshot of the desktop.
-
Wrapper Example (ActiveQt): The Wrapper example demonstrates how to export existing QWidget classes as ActiveX controls, and the use of QAxFactory together with the QAXFACTORY_EXPORT() macro. ActiveX controls in this example are the standard button classes QPushButton, QCheckBox and QRadioButton as provided by Qt.
Mobile▲
-
In-App purchasing demo: A complete mobile application that demonstrates purchasing in-app products.
-
Qt Android Notifier: Demonstrates calling Java code from Qt in an Android application.
-
Qt Quick Controls - To Do List: To do list application for iOS.
-
To Do List Example: A QML implementation of to do list application that demonstrates how to create application thats looks native on any platform.
Embedded▲
-
Qt Quick Controls - Wearable Demo: Demonstrates an application launcher designed for wearable devices.
Graphics & Multimedia▲
-
2D Painting Example: The 2D Painting example shows how QPainter and QOpenGLWidget can be used together to display accelerated 2D graphics on supported hardware.
-
40000 Chips: Visualizes a huge graphic view scene with 40000 chip items.
-
Affine Transformations: Demonstrates how affine transformations in QPainter work.
-
Analog Clock: The Analog Clock example shows how to draw the contents of a custom widget.
-
Basic Drawing Example: The Basic Drawing example shows how to display basic graphics primitives in a variety of styles using the QPainter class.
-
Basic Graphics Layouts Example: Demonstrates how to create basic graphics layout.
-
C++ Extensions: Image Provider Example: How to load images in QML with QQuickImageProvider.
-
C++ Extensions: Image Response Provider Example: How to load images asynchronously in QML.
-
Calendar Widget Example: The Calendar Widget example shows use of QCalendarWidget.
-
Colliding Mice Example: Demonstrates how to animate items on a graphics view.
-
Composition Modes: Demonstrates how Composition Modes work in QPainter.
-
Concentric Circles Example: Demonstrates the improved quality that antialiasing and floating point precision gives.
-
Diagram Scene Example: Demonstrate how to use the Graphics View framework.
-
Drag and Drop Robot Example: Demonstrates how to drag and drop items in a graphics view.
-
Easing Curves Example: The Easing Curves example shows how to use easing curves to control the speed of an animation.
-
Elastic Nodes Example: Demonstrates how to interact with graphical items in a scene.
-
Getting Started Programming with Qt Quick: A tutorial for Qt Quick based on an alarms application.
-
Gradients: Shows how gradients can be used with QPainter.
-
Hello GLES3 Example: Demonstrates OpenGL ES 3.0 functions via QOpenGLExtraFunctions.
-
Hello Vulkan Cubes Example: Shows the basics of using QVulkanWindow.
-
Hello Vulkan Triangle Example: Shows the basics of rendering with QVulkanWindow and the Vulkan API.
-
Hello Vulkan Widget Example: Shows the usage of QVulkanWindow in QWidget applications.
-
Image Composition Example: Shows how composition modes work in QPainter.
-
OpenGL Window Example: This example shows how to create a minimal QWindow based application for the purpose of using OpenGL.
-
Painter Paths Example: The Painter Paths example shows how painter paths can be used to beuild complex shapes for rendering.
-
Path Stroking: The Path Stroking example shows various types of pens that can be used with QPainter.
-
QML Example - Dynamic Scene: This example demonstrates creating components dynamically.
-
QOpenGLWidget Stereoscopic Rendering Example: This example shows how to create a minimal QOpenGLWidget based application with stereoscopic rendering support.
-
Qt Quick Controls - Attached Style Properties Example: Demonstrates use of QQuickAttachedPropertyPropagator.
-
Qt Quick Controls - Contact List: A QML app using Qt Quick Controls and a C++ class that implements a simple contact list.
-
Qt Quick Controls - Event Calendar: A simple event calendar.
-
Qt Quick Controls - Flat Style: A QML app using Qt Quick Controls and a QML plugin with customized controls.
-
Qt Quick Controls - Gallery: A gallery of controls.
-
Qt Quick Controls - Imagine Style Example: Automotive: An automotive user interface using custom Imagine style assets.
-
Qt Quick Controls - Text Editor: A QML app using Qt Quick Controls and a C++ class to provide a fully-functional rich-text editor application.
-
Qt Quick Demo - Clocks: A QML clock application that demonstrates using a ListView type to display data generated by a ListModel and a SpringAnimation type to animate images.
-
Qt Quick Examples - Accessibility: This example demonstrates the implementation of accessible buttons.
-
Qt Quick Examples - Animation: This is a collection of QML Animation examples.
-
Qt Quick Examples - Canvas: This is a collection of QML Canvas examples.
-
Qt Quick Examples - Drag and Drop: This is a collection of QML drag and drop examples.
-
Qt Quick Examples - Embedded in Widgets: Demonstrates embedding a QQuickWindow into a QWidget UI via QWidget::createWindowContainer().
-
Qt Quick Examples - Image Elements: This is a collection of QML examples relating to image types.
-
Qt Quick Examples - Item Variable Refresh Rate: A Qt Quick example shows how to setup variable refresh rate for specific parts of the UI.
-
Qt Quick Examples - Key Interaction: This is a collection of QML keyboard interaction examples.
-
Qt Quick Examples - MouseArea: This is an example of the MouseArea type in QML.
-
Qt Quick Examples - MultiEffect Item Switcher: Demonstrates MultiEffect usage.
-
Qt Quick Examples - MultiEffect Test Bed: Demonstrates MultiEffect usage.
-
Qt Quick Examples - Shader Effects: A Qt Quick example demonstrating the use of shader effects.
-
Qt Quick Examples - Shapes: A Qt Quick example demonstrating the use of shape items.
-
Qt Quick Examples - Text: This is a collection of QML examples relating to text.
-
Qt Quick Examples - Views: This is a collection of QML model-view examples.
-
Qt Quick Examples - Window and Screen: This example demonstrates the Window and Screen types in QML.
-
Qt Quick Particles Examples - Affectors: This is a collection of examples using Affectors in the QML particle system.
-
Qt Quick Particles Examples - Emitters: This is a collection of examples using Emitters in the QML particle system.
-
Qt Quick Particles Examples - Image Particles: This is a collection of examples using Affectors in the QML particle system.
-
Qt Quick Particles Examples - System: This is a collection of examples using Affectors in the QML particle system.
-
Qt Quick TableView examples - Conway’s Game of Life: The Conway’s Game of Life example shows how the QML TableView type can be used to display a C++ model that the user can pan around.
-
Qt Quick TableViews examples - Pixelator: The Pixelator example shows how a QML TableView and a delegate can be used for custom table models.
-
Raster Window Example: This example shows how to create a minimal QWindow based application using QPainter for rendering.
-
Scene Graph - Custom Geometry: Shows how to implement a custom geometry in the Qt Quick Scene Graph.
-
Scene Graph - Custom Material: Shows how to implement a custom material in the Qt Quick Scene Graph.
-
Scene Graph - Custom QSGRenderNode: Shows how to use QSGRenderNode to implement custom rendering in the Qt Quick scenegraph.
-
Scene Graph - Direct3D 11 Under QML: Shows how to render directly with Direct3D 11 under a Qt Quick scene.
-
Scene Graph - Graph: Demonstrates how one can combine custom materials and geometries under a single QQuickItem.
-
Scene Graph - Metal Texture Import: Shows how to use a texture created directly with Metal.
-
Scene Graph - Metal Under QML: Shows how to render directly with Metal under a Qt Quick scene.
-
Scene Graph - OpenGL Under QML: Shows how to render OpenGL under a Qt Quick scene.
-
Scene Graph - Painted Item: Shows how to implement QPainter-based custom scenegraph items.
-
Scene Graph - Two Texture Providers: Shows how to combine two textures from two texture providers in a custom scene graph node.
-
Scene Graph - Vulkan Texture Import: Shows how to use a texture created directly with Vulkan.
-
Scene Graph - Vulkan Under QML: Shows how to render directly with Vulkan under a Qt Quick scene.
-
Simple Anchor Layout Example: Demonstrates anchor layout on a graphics view scene.
-
Transformations Example: The Transformations example shows how transformations influence the way that QPainter renders graphics primitives.
-
UI Components: Dial Control Example: The Dial Control Example shows how to create a speedometer-type dial.
-
UI Components: Flipable Example: The Flipable Example shows an item that flips whenever clicked, rotating around the y-axis.
-
Vector Deformation: Demonstrates how to manipulate the elements of a QPainterPath.
Data Visualization & 3D▲
-
Audio Samples vs Sound Level: This example shows the drawing of microphone samples vs audio level.
-
Charts with QML Gallery: Demonstrates how to use the different chart types by using qml.
-
Charts with Widgets Gallery: An application that demonstrates the Qt Charts Widgets API.
-
Cube OpenGL ES 2.0 example: Shows how to manually rotate a textured 3D cube with user input.
-
Hello GL2 Example: The Hello GL2 example demonstrates the basic use of the OpenGL-related classes provided with Qt.
-
OpenGL Accelerated Series Example: The example shows how to enable OpenGL acceleration for QLineSeries and QScatterSeries.
-
Qml Oscilloscope: The example shows how to implement application with strict performance requirements using the Qt Charts QML API.
-
Qml Weather: This is a basic demonstration showing how to use the different chart types by using qml.
-
Qt 3D: Basic Shapes C++ Example: Shows four basic shapes that Qt 3D offers and sets up a mesh for each of them.
-
Qt 3D: Multi Viewport QML Example: A QML example that demonstrates rendering a Scenegraph from multiple viewports.
-
Qt 3D: PBR Materials QML Example: A QML application that demonstrates using PBR materials.
-
Qt 3D: Simple C++ Example: A C++ application that demonstrates how to render a scene in Qt 3D.
-
Qt 3D: Simple Custom Material QML Example: Demonstrates creating a custom material in Qt 3D.
-
Qt 3D: Simple QML Example: A QML application that demonstrates how to render a scene in Qt 3D.
-
Qt 3D: Wireframe QML Example: A Qt 3D QML application that implements a single-pass wireframe rendering method.
-
Qt Quick Demo - StocQt: A configurable stock chart for the NASDAQ-100.
-
Zoom Line Example: The example shows how to create your own custom zooming effect.
Data Processing & I/O▲
-
Books: Shows how to use Qt SQL classes with a model/view framework.
-
Cached SQL Table: The Cached Table example shows how a table view can be used to access a database, caching any changes to the data until the user explicitly submits them using a push button.
-
Convert Example: The Convert example demonstrates how to convert between different serialization formats.
-
DOM Bookmarks Application: Provides a reader for XML Bookmark Exchange Language files.
-
Drill Down Example: The Drill Down example shows how to read data from a database as well as submit changes, using the QSqlRelationalTableModel and QDataWidgetMapper classes.
-
Echo Plugin Example: This example shows how to create a Qt plugin.
-
JSON Save Game Example: The JSON Save Game example demonstrates how to save and load a small game using QJsonDocument, QJsonObject and QJsonArray.
-
Master Detail Example: The Master Detail Example shows how to present data from different data sources in the same application. The album titles, and the corresponding artists and release dates, are kept in a database, while each album's tracks are stored in an XML file.
-
Parsing and displaying CBOR data: A demonstration of how to parse files in CBOR format.
-
Prime Counter: Demonstrates how to monitor the progress of concurrent operations.
-
QXmlStream Bookmarks Example: Demonstrates how to read and write XBEL files.
-
Qt Quick Examples - Local Storage: A collection of QML local storage examples.
-
Query Model Example: The Query Model example shows how to make customized versions of data obtained from a SQL query, using a model that encapsulates the query and table views to display the results.
-
Relational Table Model Example: The Relational Table Model example shows how to use table views with a relational model to visualize the relations between items in a database.
-
SQL Browser: The SQL Browser example shows how a data browser can be used to visualize the results of SQL statements on a live database.
-
SQL Widget Mapper Example: The SQL Widget Mapper example shows how to use a map information from a database to widgets on a form.
-
Table Model Example: The Table Model example shows how to use a specialized SQL table model with table views to edit information in a database.
-
Undo Framework Example: This example shows how to implement undo/redo functionality with the Qt undo framework.
-
Word Count: Demonstrates how to use the map-reduce algorithm.
Connectivity▲
-
Annotated URL: The example shows reading from formatted NFC Data Exchange Format (NDEF) messages.
-
Bluetooth Chat: Shows communication through Bluetooth using RFCOMM protocol.
-
Bluetooth Low Energy Heart Rate Game: A game demonstrating the interaction with a Bluetooth Low Energy Heart Rate device/service.
-
Bluetooth Low Energy Heart Rate Server: An example demonstrating how to set up and advertise a GATT service. The example demonstrates the use of the Qt Bluetooth Low Energy classes related to peripheral (slave) functionality.
-
Bluetooth Low Energy Scanner: An application designed to browse the content of Bluetooth Low Energy peripheral devices. The example demonstrates the use of all Qt Bluetooth Low Energy classes.
-
D-Bus Chat: Demonstrates communication among instances of an application.
-
D-Bus Complex Ping Pong: Demonstrates usage of the Qt D-Bus typesystem.
-
D-Bus Ping Pong: Demonstrates a simple message system using D-Bus.
-
D-Bus Remote Controlled Car: Shows how to use Qt D-Bus to control a car from another application.
-
NDEF Editor Example: An example of reading and writing NFC Data Exchange Format (NDEF) messages to NFC Forum Tags.
-
Quick CoAP Multicast Discovery: Using the CoAP client for a multicast resource discovery with a Qt Quick user interface.
-
Quick Secure CoAP Client: Securing the CoAP client and using it with a Qt Quick user interface.
-
Simple CoAP Client: Creating an application that communicates with a CoAP server.
Networking▲
-
A minimal RSS listing application: A demonstration of how to fetch and display a network resource.
-
Blocking Fortune Client: Demonstrates how to create a client for a network service.
-
DTLS client: This example demonstrates how to implement client-side DTLS connections.
-
DTLS server: This examples demonstrates how to implement a simple DTLS server.
-
Fortune Client: Demonstrates how to create a client for a network service.
-
Fortune Server: Demonstrates how to create a server for a network service.
-
HTTP Client: Demonstrates a simple HTTP client.
-
Image Scaling: Demonstrates how to asynchronously download and scale images.
-
Multicast Receiver: Demonstrates how to receive information sent to a multicast group.
-
Multicast Sender: Demonstrates how to send messages to a multicast group.
-
Qt Quick Demo - RESTful Color Palette API client: Example of how to create a RESTful API QML client.
-
Threaded Fortune Server: The Threaded Fortune Server example shows how to create a server for a simple network service that uses threads to handle requests from different clients. It is intended to be run alongside the Fortune Client example.
-
Torrent Example: Demonstrates complex TCP/IP operations.
Positioning & Location▲
-
GeoJson Viewer (C++/QML): The GeoJson viewer example demonstrates how to manipulate MapItems, handle user input and I/O to and from a GeoJson file.
-
Log File Position Source (C++): Logfile Position Source shows how to create and work with a custom position source. It can be useful for simulating GPS data, or when the data is received in some custom format.
-
MapItemView Transitions (QML): How to use transitions together with MapItemView.
-
Minimal Map (QML): The minimum code to display a map using Qt Quick.
-
Places (QML): The Places example demonstrates how to search for Places and access related content.
-
Places List (QML): The Places List example demonstrates how to search for and display a list of places using a ListView.
-
Places Map (QML): The Places Map example demonstrates how to search for and display a list of places on a map using a MapItemView.
-
Plane Spotter (QML): The Plane Spotter example demonstrates the tight integration of location and positioning data types into QML.
-
SatelliteInfo (QML): The SatelliteInfo example shows the available satellites using Sky View or RSSI View and the user's current position. The satellites currently contributing to the GPS fix are marked as pink.
-
Weather Info (C++/QML): The Weather Info example shows how to use the user's current position to retrieve local content from a web service in a C++ plugin for QML.
User Interface Components▲
-
Address Book: The address book example shows how to use proxy models to display different views onto data from a single model.
-
Basic Layouts Example: Shows how to use the standard layout managers.
-
Basic Sort/Filter Model Example: The Basic Sort/Filter Model example illustrates how to use QSortFilterProxyModel to perform basic sorting and filtering.
-
Calculator Example: The example shows how to use signals and slots to implement the functionality of a calculator widget, and how to use QGridLayout to place child widgets in a grid.
-
Color Editor Factory Example: This example shows how to create an editor that can be used by a QItemDelegate.
-
Combo Widget Mapper Example: The Combo Widget Mapper example shows how to use a custom delegate to map information from a model to specific widgets on a form.
-
Completer Example: The Completer example shows how to provide string-completion facilities for an input widget based on data provided by a model.
-
Context-Sensitive Help Example: Using the QHelpEngineCore class to implement context-sensitive help for applications.
-
Custom Sort/Filter Model Example: The Custom Sort/Filter Model example illustrates how to subclass QSortFilterProxyModel to perform advanced sorting and filtering.
-
Draggable Icons Example: The Draggable Icons example shows how to drag and drop image data between widgets in the same application, and between different applications.
-
Draggable Text Example: Illustrates how to drag and drop text between widgets.
-
Drop Site Example: The example shows how to distinguish the various MIME formats available in a drag and drop operation.
-
Editable Tree Model Example: This example shows how to implement a simple item-based tree model that can be used with other classes in the model/view framework.
-
Fetch More Example: The Fetch More example shows how to add items to an item view model on demand.
-
Flow Layout Example: Shows how to arrange widgets for different window sizes.
-
Frozen Column Example: This example demonstrates how to freeze a column within a QTableView.
-
Getting Started Programming with Qt Widgets: A tutorial for Qt Widgets based notepad application.
-
Group Box Example: The Group Box example shows how to use the different kinds of group boxes in Qt.
-
Image Gestures Example: Demonstrates the use of simple gestures in a widget.
-
License Wizard Example: The License Wizard example shows how to implement complex wizards in Qt.
-
Menus Example: The Menus example demonstrates how menus can be used in a main window application.
-
Order Form Example: The Order Form example shows how to generate rich text documents by combining a simple template with data input by the user in a dialog.
-
QRegularExpression Example: The QRegularExpression example shows how regular expressions in Qt are applied to text by providing an environment in which new regular expressions can be created and tested on custom text strings.
-
Qt Quick I18N: Generating translation files (TS and QM) for a Qt Quick application.
-
Scribble Example: The Scribble example shows how to reimplement some of QWidget's event handlers to receive the events generated for the application's widgets.
-
Settings Editor Example: The Settings Editor example shows how Qt's standard settings support is used in an application by providing an editor that enables the user to view the settings for installed applications, and modify those that can be edited.
-
Shortcut Editor Example: The Shortcut Editor example shows how to create a basic, read-write hierarchical model to use with Qt's standard view and QKeySequenceEdit classes. For a description of Model/View Programming, see the Model/View Programming overview.
-
Simple Tree Model Example: The Simple Tree Model example shows how to use a hierarchical model with Qt's standard view classes.
-
Sliders Example: The Sliders example shows how to use the different types of sliders available in Qt: QSlider, QScrollBar and QDial.
-
Spin Box Delegate Example: The Spin Box Delegate example shows how to create an editor for a custom delegate in the model/view framework by reusing a standard Qt editor widget.
-
Spin Boxes Example: The Spin Boxes example shows how to use the many different types of spin boxes available in Qt, from a simple QSpinBox widget to more complex editors like the QDateTimeEdit widget.
-
Spreadsheet: The Spreadsheet example shows how to create a simple spreadsheet application.
-
Standard Dialogs Example: The Standard Dialogs example shows the standard dialogs that are provided by Qt.
-
Star Delegate Example: The Star Delegate example shows how to create a delegate that can paint itself and that supports editing.
-
Style Plugin Example: This example shows how to create a plugin that extends Qt with a new GUI look and feel.
-
Syntax Highlighter Example: The Syntax Highlighter example shows how to perform simple syntax highlighting.
-
Tab Dialog Example: The Tab Dialog example shows how to construct a tab dialog using the QTabWidget class.
-
Tablet Example: This example shows how to use a Wacom tablet in Qt applications.
-
Tool Tips Example: The Tool Tips example shows how to provide static and dynamic tool tips for an application's widgets.
-
Touch Knobs Example: Shows how to create custom controls that accept touch input.
-
Translucent Background: The example shows how to make a round window with a translucent background.
-
Tree Model Completer Example: The Tree Model Completer example shows how to provide completion facilities for a hierarchical model, using a period as the separator to access Child, GrandChild and GrandGrandChild level objects.
-
Trivial Wizard Example: The Trivial Wizard example illustrates how to create a linear three-page registration wizard using three instances of QWizardPage and one instance of QWizard.
-
Widgets Gallery Example: The Widgets Gallery example shows widgets relevant for designing UIs.
-
Window Flags Example: The Window Flags example shows how to use the window flags available in Qt.
Web Technologies▲
-
Qt Quick Demo - RSS News: A QML RSS news reader that uses XmlListModel and XmlListModelRole custom QML types to download XML data, ListModel and ListElement to create a category list, and ListView to display the data.
Community Examples▲
To view and run examples provided through the Qt Project, visit the Community Examples page.
All Examples▲
All Qt Examples lists all examples categorized by the Qt module they belong to.