January 2019
Intermediate to advanced
384 pages
11h 50m
English
We said that we cannot use the std::thread class because it does not provide the event loop. Well, that's not entirely true. In fact, we could mimic QThread inside of the regular std::thread by using a QEventLoop instance to run a thread-local event loop. We could even move a QObject into that thread's context because the static QThread::currentThread() function will give you a QThread* we can use for this purpose.
But, why should we want to do that? Just look at this as an exercise, testing your understanding of Qt threading mechanisms.
Read now
Unlock full access