Skip to content

qt-learning/Threading

Repository files navigation

Threading

Welcome to the repository for the course "Threading" on Qt Academy.

Get the full learning experience by enrolling in the course on Qt Academy.

What You'll Learn

  • Creating and managing QThreads to run work off the main thread and monitor thread state.

  • Using the worker object pattern to move custom classes into QThread and communicate via signals and slots without blocking the UI.

  • Leveraging QRunnable and QThreadPool to efficiently manage concurrent tasks with automatic thread management.

  • Protecting shared data between threads using QMutex, QMutexLocker, and QSemaphore for safe concurrent access.

  • Using QtConcurrent to simplify multithreading with QFuture, concurrent Task, Map, and Filter operations.

Getting Started

In this course, you will explore the fundamentals of multithreading in Qt, including creating and managing threads, running concurrent tasks, protecting shared data, and using the QtConcurrent high-level API. You'll learn how to keep your UI responsive while performing intensive work in the background.

The repository contains reference projects for each video section:

Folder Description
Threading_Section1a Creating a QThread and monitoring its state
Threading_Section1b Worker object pattern with signals/slots and threaded progress bars
Threading_Section2a QRunnable and QThreadPool management
Threading_Section2b Image processing with QRunnable tasks in a QThreadPool
Threading_Section3a Sharing data between threads with QMutex and QMutexLocker
Threading_Section3b Using QSemaphore to manage limited resources
Threading_Section4 QtConcurrent with QFuture, Task, Map, and Filter

Note: The projects are not required to complete the course, but are provided as a reference to help you understand the concepts discussed.

All examples were built and tested with Qt 6.9.2 MinGW 64-bit.

Prerequisites

Before getting started, you should be familiar with Qt and C++ fundamentals. Consider first exploring the relevant learning paths on Qt Academy, which provide the foundational knowledge needed to get the most from this course.

Instructions

To get started with this project, you will need to have Qt (6.8 or later) and an IDE (e.g., Qt Creator) installed on your computer. You can download Qt and Qt Creator from the Qt.io website.

Once you have Qt and an IDE installed, head over to Qt Academy and follow along with the course videos.

To run any project in Qt Creator:

  1. Navigate to the project folder
  2. Open the CMakeLists.txt file
  3. Build and run the project

Resources

If you need additional help, the following resources may be helpful:

Licensing Information

Copyright (C) 2026 Qt Group.
SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

This example covers essential techniques for multithreading in Qt applications to achieve responsive, high-performance software.

Terms and Conditions

If you, your employer, or the legal entity you act on behalf of hold commercial license(s) with a Qt Group entity, this software package constitutes Pre-Release Code under the Qt License/Frame Agreement governing those licenses, and that agreement's terms and conditions govern your access and use of this software package.

This software package may provide links or access to third party libraries or code (collectively "Third-Party Software") to implement various functions. Use or distribution of Third-Party Software is discretionary and in all respects subject to applicable license terms of applicable third-party right holders.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors