Qt
Qt is a relatively high-level framework, which also reflects in its multithreading API. Another defining feature of Qt is that it wraps its own code (QApplication and QMainWindow) along with the use of a meta-compiler (qmake) to implement its signal-slot architecture and other defining features of the framework.
As a result, Qt's threading support cannot be added into existing code as-is, but requires one to adapt one's code to fit the framework.
QThread
A QThread class in Qt is not a thread, but an extensive wrapper around a thread instance, which adds signal-slot communication, runtime support, and other features. This is reflected in the basic usage of a QThread, as shown in the following code:
class Worker : public QObject {
Q_OBJECT
public:
Worker();
~Worker();
public slots:
void process();
signals:
void finished();
void error(QString err);
private:
}; This preceding code is a basic Worker class, which will contain...