Multithreading in Qt
The Qt framework offers many different technologies to deal with in applications. The QThread
class is used to handle all sorts of multithreading functionality and, as we'll see in this chapter, using it is also the most powerful and flexible way of handling threads in Qt framework. In addition to QThread
, the framework offers a number of other namespaces, classes, and functions that help with various multithreading requirements. Here's a list of them, before we see examples of how they are used:
QThread
: This class is the base of all threads in the Qt framework. It can be subclassed to create new threads, in which case, you need to override therun
method, or you can create new instances of it and move any Qt object (theQObject
subclass) into a new thread by calling themoveToThread
function.QThreadPool
: This can be used to manage threads and help reduce thread creation costs by allowing existing threads to be reused for new purposes. Every Qt application contains...