Skip to content

Multithreading with Qt

This series will introduce you to the basics of multithreading with Qt, give you some best practices and recommendations on how to avoid some pitfalls. You may wonder what’s the benefit of multithreading? Multithreading allows the execution of several parts of the same program simultaneously and efficiently in order to lead to maximum use of the CPU using multitasking. To benefit from watching this series viewers should be familiar with QObject and Signals and Slots. The topics in this series are an extract of a 3-days training. Get more information here…

This video introduces the series, defines multithreading, and advises on what are the things you should know or learn before watching this video series.

Signals and slots video from our Introduction to  Qt/QML series : https://www.youtube.com/watch?v=xHd5Ga8uihE

You can find more information about our multithreading training here: https://www.kdab.com/software-services/scheduled-training/multithreading/

All Multithreading with Qt videos: 
https://www.youtube.com/playlist?list=PL6CJYn40gN6jgr-Rpl3J4XDQYhmUnxb-g

About the host
This video is presented by David Faure, who started with Qt back in 1998 in the KDE project, where he's still very active. This gives him 22 years of experience with Qt.  Since 2003, he has taught many Qt training courses on topics such as Qt Widgets, Multithreading, Modern C++, and Debugging/Profiling on Linux. He has made many contributions to QtCore and has helped numerous customers, especially with Qt multithreading issues.

About KDAB:
KDAB offers experienced software experts to help you deliver functional, high-performing, and innovative software across embedded, mobile, and desktop platforms for projects using C++, Qt, QML/Qt Quick, OpenGL, Qt 3D, and more.  https://www.kdab.com/software-services

KDAB experts regularly take time out to deliver KDAB’s world class training, in-house or at open enrollment courses around the world.  We are the market leaders for training in Qt, OpenGL, and C++.

Contact us to find out more at training@kdab.com or visit our website: https://www.kdab.com/software-services/scheduled-training/

We are about 90 people, located all around the world. Our Head Office is in Sweden and we have other offices in Germany, France, the UK, and the USA. https://www.kdab.com/about/contact/
Multithreading with Qt (Part 1) - Introduction to Multithreading with Qt

This video introduces the series, defines multithreading, and advises on what are the things you should know or learn before watching this video series.

Signals and slots video from our Introduction to Qt/QML series : https://www.youtube.com/watch?v=xHd5Ga8uihE

You can find more information about our multithreading training here: https://www.kdab.com/software-services/scheduled-training/multithreading/

All Multithreading with Qt videos:
https://www.youtube.com/playlist?list=PL6CJYn40gN6jgr-Rpl3J4XDQYhmUnxb-g

About the host
This video is presented by David Faure, who started with Qt back in 1998 in the KDE project, where he's still very active. This gives him 22 years of experience with Qt. Since 2003, he has taught many Qt training courses on topics such as Qt Widgets, Multithreading, Modern C++, and Debugging/Profiling on Linux. He has made many contributions to QtCore and has helped numerous customers, especially with Qt multithreading issues.

About KDAB:
KDAB offers experienced software experts to help you deliver functional, high-performing, and innovative software across embedded, mobile, and desktop platforms for projects using C++, Qt, QML/Qt Quick, OpenGL, Qt 3D, and more. https://www.kdab.com/software-services

KDAB experts regularly take time out to deliver KDAB’s world class training, in-house or at open enrollment courses around the world. We are the market leaders for training in Qt, OpenGL, and C++.

Contact us to find out more at training@kdab.com or visit our website: https://www.kdab.com/software-services/scheduled-training/

We are about 90 people, located all around the world. Our Head Office is in Sweden and we have other offices in Germany, France, the UK, and the USA. https://www.kdab.com/about/contact/

172 14

YouTube Video UEw2Q0pZbjQwZ042amdyLVJwbDNKNFhEUVlobVVueGItZy41NkI0NEY2RDEwNTU3Q0M2

Multithreading with Qt (Part 1) - Introduction to Multithreading with Qt

In this video, you will learn about the three ways to create threads in Qt (did you know about QThread::create?). You will also learn how to wait for threads to finish, what can and cannot be done in a secondary thread, and how to properly destruct QObjects used in threads.

For the complete QThread API documentation, see: https://doc.qt.io/qt-5/qthread.html

You can find more information about our multithreading training here: https://www.kdab.com/software-services/scheduled-training/multithreading/

All Multithreading with Qt videos: 
https://www.youtube.com/playlist?list=PL6CJYn40gN6jgr-Rpl3J4XDQYhmUnxb-g

About the host
This video is presented by David Faure, who started with Qt back in 1998 in the KDE project, where he's still very active. This gives him 22 years of experience with Qt. Since 2003, he has taught many Qt training courses on topics such as Qt Widgets, Multithreading, Modern C++, and Debugging/Profiling on Linux. He has done many contributions to QtCore and has helped numerous customers, especially with Qt multithreading issues.

About KDAB
KDAB offers experienced software experts to help you deliver functional, high-performing, and innovative software across embedded, mobile, and desktop platforms for projects using C++, Qt, QML/Qt Quick, OpenGL, Qt 3D, and more.  https://www.kdab.com/software-services

KDAB experts regularly take time out to deliver KDAB’s world class training, in-house or at open enrollment courses around the world. We are the market leaders for training in Qt, OpenGL, and C++.

Contact us to find out more at training@kdab.com or visit our website: https://www.kdab.com/software-services/scheduled-training/

We are about 90 people, located all around the world. Our Head Office is in Sweden and we have other offices in Germany, France, the UK, and the USA. https://www.kdab.com/about/contact/
Multithreading with Qt (Part 2) - QThread

In this video, you will learn about the three ways to create threads in Qt (did you know about QThread::create?). You will also learn how to wait for threads to finish, what can and cannot be done in a secondary thread, and how to properly destruct QObjects used in threads.

For the complete QThread API documentation, see: https://doc.qt.io/qt-5/qthread.html

You can find more information about our multithreading training here: https://www.kdab.com/software-services/scheduled-training/multithreading/

All Multithreading with Qt videos:
https://www.youtube.com/playlist?list=PL6CJYn40gN6jgr-Rpl3J4XDQYhmUnxb-g

About the host
This video is presented by David Faure, who started with Qt back in 1998 in the KDE project, where he's still very active. This gives him 22 years of experience with Qt. Since 2003, he has taught many Qt training courses on topics such as Qt Widgets, Multithreading, Modern C++, and Debugging/Profiling on Linux. He has done many contributions to QtCore and has helped numerous customers, especially with Qt multithreading issues.

About KDAB
KDAB offers experienced software experts to help you deliver functional, high-performing, and innovative software across embedded, mobile, and desktop platforms for projects using C++, Qt, QML/Qt Quick, OpenGL, Qt 3D, and more. https://www.kdab.com/software-services

KDAB experts regularly take time out to deliver KDAB’s world class training, in-house or at open enrollment courses around the world. We are the market leaders for training in Qt, OpenGL, and C++.

Contact us to find out more at training@kdab.com or visit our website: https://www.kdab.com/software-services/scheduled-training/

We are about 90 people, located all around the world. Our Head Office is in Sweden and we have other offices in Germany, France, the UK, and the USA. https://www.kdab.com/about/contact/

184 8

YouTube Video UEw2Q0pZbjQwZ042amdyLVJwbDNKNFhEUVlobVVueGItZy4yODlGNEE0NkRGMEEzMEQy

Multithreading with Qt (Part 2) - QThread

After a short presentation of a QThread without an event loop, this video will tell you about threads with an event loop. This allows handling events for objects in secondary threads, which is necessary in order to be able to call slots on these objects. 

The video then presents two different ways to do this: creating both the thread and the worker at the same level, or encapsulating the thread into the worker.

You can find more information about our multithreading training here: https://www.kdab.com/software-services/scheduled-training/multithreading/

The code is available on: 
https://github.com/KDABLabs/kdabtv/tree/master/Multithreading-with-Qt/ActiveObject

All Multithreading with Qt videos: 
https://www.youtube.com/playlist?list=PL6CJYn40gN6jgr-Rpl3J4XDQYhmUnxb-g

About the host:
This video is presented by David Faure, who started with Qt back in 1998 in the KDE project where he's still very active. This gives him 22 years of experience with Qt. Since 2003 he has taught many Qt training courses, on topics such as Qt Widgets, Multithreading, Modern C++ and Debugging/Profiling on Linux. He has made many contributions to QtCore, and has helped numerous customers, especially with Qt multithreading issues.

About KDAB:
KDAB offers experienced software experts to help you deliver functional, high-performing, and innovative software across embedded, mobile, and desktop platforms for projects using C++, Qt, QML/Qt Quick, OpenGL, Qt 3D, and more.  https://www.kdab.com/software-services

KDAB experts regularly take time out to deliver KDAB’s world class training, in-house or at open enrollment courses around the world. We are the market leaders for training in Qt, OpenGL and C++.

Contact us to find out more at training@kdab.com or visit our website: https://www.kdab.com/software-services/scheduled-training/

We are about 90 people, located all around the world. Our Head Office is in Sweden and we have other offices in Germany, France, the UK, and the USA. https://www.kdab.com/about/contact/
Multithreading with Qt (Part 3) - QThread with an event loop

After a short presentation of a QThread without an event loop, this video will tell you about threads with an event loop. This allows handling events for objects in secondary threads, which is necessary in order to be able to call slots on these objects.

The video then presents two different ways to do this: creating both the thread and the worker at the same level, or encapsulating the thread into the worker.

You can find more information about our multithreading training here: https://www.kdab.com/software-services/scheduled-training/multithreading/

All Multithreading with Qt videos:
https://www.youtube.com/playlist?list=PL6CJYn40gN6jgr-Rpl3J4XDQYhmUnxb-g

About the host:
This video is presented by David Faure, who started with Qt back in 1998 in the KDE project where he's still very active. This gives him 22 years of experience with Qt. Since 2003 he has taught many Qt training courses, on topics such as Qt Widgets, Multithreading, Modern C++ and Debugging/Profiling on Linux. He has made many contributions to QtCore, and has helped numerous customers, especially with Qt multithreading issues.

About KDAB:
KDAB offers experienced software experts to help you deliver functional, high-performing, and innovative software across embedded, mobile, and desktop platforms for projects using C++, Qt, QML/Qt Quick, OpenGL, Qt 3D, and more. https://www.kdab.com/software-services

KDAB experts regularly take time out to deliver KDAB’s world class training, in-house or at open enrollment courses around the world. We are the market leaders for training in Qt, OpenGL and C++.

Contact us to find out more at training@kdab.com or visit our website: https://www.kdab.com/software-services/scheduled-training/

We are about 90 people, located all around the world. Our Head Office is in Sweden and we have other offices in Germany, France, the UK, and the USA. https://www.kdab.com/about/contact/

172 37

YouTube Video UEw2Q0pZbjQwZ042amdyLVJwbDNKNFhEUVlobVVueGItZy4wMTcyMDhGQUE4NTIzM0Y5

Multithreading with Qt (Part 3) - QThread with an event loop

If you think bool is atomic (and therefore needs no mutex) or if you think volatile is useful in multithreaded programs, you should watch this video.  Also, you will learn two different ways to implement asking for a QThread's run() method to finish.

You can find more information about our multithreading training here: https://www.kdab.com/software-services/scheduled-training/multithreading/

All Multithreading with Qt videos: 
https://www.youtube.com/playlist?list=PL6CJYn40gN6jgr-Rpl3J4XDQYhmUnxb-g

About the host:
This video is presented by David Faure, who started with Qt back in 1998 in the KDE project where he's still very active. This gives him 22 years of experience with Qt. Since 2003 he has taught many Qt training courses, on topics such as Qt Widgets, Multithreading, Modern C++ and Debugging/Profiling on Linux. He has made many contributions to QtCore, and has helped numerous customers, especially with Qt multithreading issues.

About KDAB:

KDAB offers experienced software experts to help you deliver functional, high-performing, and innovative software across embedded, mobile, and desktop platforms for projects using C++, Qt, QML/Qt Quick, OpenGL, Qt 3D, and more.  https://www.kdab.com/software-services


KDAB experts regularly take time out to deliver KDAB’s world class training, in-house or at open enrollment courses around the world. We are the market leaders for training in Qt, OpenGL, and C++.

Contact us to find out more at training@kdab.com or visit our website: https://www.kdab.com/software-services/scheduled-training/

We are about 90 people, located all around the world. Our Head Office is in Sweden and we have other offices in Germany, France, the UK, and the USA. https://www.kdab.com/about/contact/
Multithreading with Qt (Part 4) - Data Races and How to Avoid Them

If you think bool is atomic (and therefore needs no mutex) or if you think volatile is useful in multithreaded programs, you should watch this video. Also, you will learn two different ways to implement asking for a QThread's run() method to finish.

You can find more information about our multithreading training here: https://www.kdab.com/software-services/scheduled-training/multithreading/

All Multithreading with Qt videos:
https://www.youtube.com/playlist?list=PL6CJYn40gN6jgr-Rpl3J4XDQYhmUnxb-g

About the host:
This video is presented by David Faure, who started with Qt back in 1998 in the KDE project where he's still very active. This gives him 22 years of experience with Qt. Since 2003 he has taught many Qt training courses, on topics such as Qt Widgets, Multithreading, Modern C++ and Debugging/Profiling on Linux. He has made many contributions to QtCore, and has helped numerous customers, especially with Qt multithreading issues.

About KDAB:

KDAB offers experienced software experts to help you deliver functional, high-performing, and innovative software across embedded, mobile, and desktop platforms for projects using C++, Qt, QML/Qt Quick, OpenGL, Qt 3D, and more. https://www.kdab.com/software-services


KDAB experts regularly take time out to deliver KDAB’s world class training, in-house or at open enrollment courses around the world. We are the market leaders for training in Qt, OpenGL, and C++.

Contact us to find out more at training@kdab.com or visit our website: https://www.kdab.com/software-services/scheduled-training/

We are about 90 people, located all around the world. Our Head Office is in Sweden and we have other offices in Germany, France, the UK, and the USA. https://www.kdab.com/about/contact/

109 10

YouTube Video UEw2Q0pZbjQwZ042amdyLVJwbDNKNFhEUVlobVVueGItZy41MjE1MkI0OTQ2QzJGNzNG

Multithreading with Qt (Part 4) - Data Races and How to Avoid Them

This video provides answers to the following questions: Can you call methods on an object shared between threads? Can you call the same method in different objects? What about QObject, is it thread-safe?

You can find more information about our multithreading training here: https://www.kdab.com/software-services/scheduled-training/multithreading/

All Multithreading with Qt videos: 
https://www.youtube.com/playlist?list=PL6CJYn40gN6jgr-Rpl3J4XDQYhmUnxb-g

About the host:
This video is presented by David Faure, who started with Qt back in 1998 in the KDE project where he's still very active. This gives him 22 years of experience with Qt. Since 2003 he has taught many Qt training courses, on topics such as Qt Widgets, Multithreading, Modern C++ and Debugging/Profiling on Linux. He has made many contributions to QtCore, and has helped numerous customers, especially with Qt multithreading issues.

About KDAB:
KDAB offers experienced software experts to help you deliver functional, high-performing, and innovative software across embedded, mobile, and desktop platforms for projects using C++, Qt, QML/Qt Quick, OpenGL, Qt 3D, and more.  https://www.kdab.com/software-services

KDAB experts regularly take time out to deliver KDAB’s world class training, in-house or at open enrollment courses around the world. We are the market leaders for training in Qt, OpenGL, and C++.

Contact us to find out more at training@kdab.com or visit our website: https://www.kdab.com/software-services/scheduled-training/

We are about 90 people, located all around the world. Our Head Office is in Sweden and we have other offices in Germany, France, the UK, and the USA. https://www.kdab.com/about/contact/
Multithreading with Qt (Part 5) - Thread Safety in Qt

This video provides answers to the following questions: Can you call methods on an object shared between threads? Can you call the same method in different objects? What about QObject, is it thread-safe?

You can find more information about our multithreading training here: https://www.kdab.com/software-services/scheduled-training/multithreading/

All Multithreading with Qt videos:
https://www.youtube.com/playlist?list=PL6CJYn40gN6jgr-Rpl3J4XDQYhmUnxb-g

About the host:
This video is presented by David Faure, who started with Qt back in 1998 in the KDE project where he's still very active. This gives him 22 years of experience with Qt. Since 2003 he has taught many Qt training courses, on topics such as Qt Widgets, Multithreading, Modern C++ and Debugging/Profiling on Linux. He has made many contributions to QtCore, and has helped numerous customers, especially with Qt multithreading issues.

About KDAB:
KDAB offers experienced software experts to help you deliver functional, high-performing, and innovative software across embedded, mobile, and desktop platforms for projects using C++, Qt, QML/Qt Quick, OpenGL, Qt 3D, and more. https://www.kdab.com/software-services

KDAB experts regularly take time out to deliver KDAB’s world class training, in-house or at open enrollment courses around the world. We are the market leaders for training in Qt, OpenGL, and C++.

Contact us to find out more at training@kdab.com or visit our website: https://www.kdab.com/software-services/scheduled-training/

We are about 90 people, located all around the world. Our Head Office is in Sweden and we have other offices in Germany, France, the UK, and the USA. https://www.kdab.com/about/contact/

76 6

YouTube Video UEw2Q0pZbjQwZ042amdyLVJwbDNKNFhEUVlobVVueGItZy4wOTA3OTZBNzVEMTUzOTMy

Multithreading with Qt (Part 5) - Thread Safety in Qt

In this video, you will learn about communicating between two threads using Qt signals and slots and what is really happening under the hood when you do that. 

With the help of didactic diagrams, you will learn different ways to set this all up, including possible pitfalls.

Signals and Slots video from our Introduction to Qt / QML series: https://youtu.be/xHd5Ga8uihE
Multithreading with Qt playlist: https://www.youtube.com/playlist?list=PL6CJYn40gN6jgr-Rpl3J4XDQYhmUnxb-g

You can find more information about our multithreading training here: https://www.kdab.com/software-services/scheduled-training/multithreading/

All Multithreading with Qt videos: 
https://www.youtube.com/playlist?list=PL6CJYn40gN6jgr-Rpl3J4XDQYhmUnxb-g

About the host: 
This video is presented by David Faure, who started with Qt back in 1998 in the KDE project where he's still very active. This gives him 22 years of experience with Qt. Since 2003 he has taught many Qt training courses, on topics such as Qt Widgets, Multithreading, Modern C++ and Debugging/Profiling on Linux. He has made many contributions to QtCore, and has helped numerous customers, especially with Qt multithreading issues.

About KDAB:
KDAB offers experienced software experts to help you deliver functional, high-performing, and innovative software across embedded, mobile, and desktop platforms for projects using C++, Qt, QML/Qt Quick, OpenGL, Qt 3D, and more.  https://www.kdab.com/software-services

KDAB experts regularly take time out to deliver KDAB’s world class training, in-house or at open enrollment courses around the world. We are the market leaders for training in Qt, OpenGL, and C++.

Contact us to find out more at training@kdab.com or visit our website: https://www.kdab.com/software-services/scheduled-training/

We are about 90 people, located all around the world. Our Head Office is in Sweden and we have other offices in Germany, France, the UK, and the USA. https://www.kdab.com/about/contact/
Multithreading with Qt (Part 6) - Signals and Slots across Threads

In this video, you will learn about communicating between two threads using Qt signals and slots and what is really happening under the hood when you do that.

With the help of didactic diagrams, you will learn different ways to set this all up, including possible pitfalls.

Signals and Slots video from our Introduction to Qt / QML series: https://youtu.be/xHd5Ga8uihE
Multithreading with Qt playlist: https://www.youtube.com/playlist?list=PL6CJYn40gN6jgr-Rpl3J4XDQYhmUnxb-g

You can find more information about our multithreading training here: https://www.kdab.com/software-services/scheduled-training/multithreading/

All Multithreading with Qt videos:
https://www.youtube.com/playlist?list=PL6CJYn40gN6jgr-Rpl3J4XDQYhmUnxb-g

About the host:
This video is presented by David Faure, who started with Qt back in 1998 in the KDE project where he's still very active. This gives him 22 years of experience with Qt. Since 2003 he has taught many Qt training courses, on topics such as Qt Widgets, Multithreading, Modern C++ and Debugging/Profiling on Linux. He has made many contributions to QtCore, and has helped numerous customers, especially with Qt multithreading issues.

About KDAB:
KDAB offers experienced software experts to help you deliver functional, high-performing, and innovative software across embedded, mobile, and desktop platforms for projects using C++, Qt, QML/Qt Quick, OpenGL, Qt 3D, and more. https://www.kdab.com/software-services

KDAB experts regularly take time out to deliver KDAB’s world class training, in-house or at open enrollment courses around the world. We are the market leaders for training in Qt, OpenGL, and C++.

Contact us to find out more at training@kdab.com or visit our website: https://www.kdab.com/software-services/scheduled-training/

We are about 90 people, located all around the world. Our Head Office is in Sweden and we have other offices in Germany, France, the UK, and the USA. https://www.kdab.com/about/contact/

139 12

YouTube Video UEw2Q0pZbjQwZ042amdyLVJwbDNKNFhEUVlobVVueGItZy4xMkVGQjNCMUM1N0RFNEUx

Multithreading with Qt (Part 6) - Signals and Slots across Threads

This video compares the multithreading facilities in Qt with those provided by the C++ standard library. Which one has a semaphore class? A thread pool implementation? A movable lock guard? Which one has the most convenient condition variable API?

You can find more information about our multithreading training here: https://www.kdab.com/software-services/scheduled-training/multithreading/

All Multithreading with Qt videos: 
https://www.youtube.com/playlist?list=PL6CJYn40gN6jgr-Rpl3J4XDQYhmUnxb-g

About the host:
This video is presented by David Faure, who started with Qt back in 1998 in the KDE project where he's still very active. This gives him 22 years of experience with Qt. Since 2003 he has taught many Qt training courses, on topics such as Qt Widgets, Multithreading, Modern C++ and Debugging/Profiling on Linux. He has made many contributions to QtCore, and has helped numerous customers, especially with Qt multithreading issues.

About KDAB:

KDAB offers experienced software experts to help you deliver functional, high-performing, and innovative software across embedded, mobile, and desktop platforms for projects using C++, Qt, QML/Qt Quick, OpenGL, Qt 3D, and more.  https://www.kdab.com/software-services

KDAB experts regularly take time out to deliver KDAB’s world class training, in-house or at open enrollment courses around the world. We are the market leaders for training in Qt, OpenGL, and C++.

Contact us to find out more at training@kdab.com or visit our website: https://www.kdab.com/software-services/scheduled-training/

We are about 90 people, located all around the world. Our Head Office is in Sweden and we have other offices in Germany, France, the UK, and the USA. https://www.kdab.com/about/contact/
Multithreading with Qt (Part 7) - Comparison of Qt and STL Multithreading Classes

This video compares the multithreading facilities in Qt with those provided by the C++ standard library. Which one has a semaphore class? A thread pool implementation? A movable lock guard? Which one has the most convenient condition variable API?

You can find more information about our multithreading training here: https://www.kdab.com/software-services/scheduled-training/multithreading/

All Multithreading with Qt videos:
https://www.youtube.com/playlist?list=PL6CJYn40gN6jgr-Rpl3J4XDQYhmUnxb-g

About the host:
This video is presented by David Faure, who started with Qt back in 1998 in the KDE project where he's still very active. This gives him 22 years of experience with Qt. Since 2003 he has taught many Qt training courses, on topics such as Qt Widgets, Multithreading, Modern C++ and Debugging/Profiling on Linux. He has made many contributions to QtCore, and has helped numerous customers, especially with Qt multithreading issues.

About KDAB:

KDAB offers experienced software experts to help you deliver functional, high-performing, and innovative software across embedded, mobile, and desktop platforms for projects using C++, Qt, QML/Qt Quick, OpenGL, Qt 3D, and more. https://www.kdab.com/software-services

KDAB experts regularly take time out to deliver KDAB’s world class training, in-house or at open enrollment courses around the world. We are the market leaders for training in Qt, OpenGL, and C++.

Contact us to find out more at training@kdab.com or visit our website: https://www.kdab.com/software-services/scheduled-training/

We are about 90 people, located all around the world. Our Head Office is in Sweden and we have other offices in Germany, France, the UK, and the USA. https://www.kdab.com/about/contact/

83 4

YouTube Video UEw2Q0pZbjQwZ042amdyLVJwbDNKNFhEUVlobVVueGItZy41MzJCQjBCNDIyRkJDN0VD

Multithreading with Qt (Part 7) - Comparison of Qt and STL Multithreading Classes