Using QThreadPool in MandelbrotCalculator

Now that our Job class is ready to be used, we need to create a class to manage the jobs. Please create a new class, MandelbrotCalculator. Let's see what we need in the file, MandelbrotCalculator.h:

#include <QObject> 
#include <QSize> 
#include <QPointF> 
#include <QElapsedTimer> 
#include <QList> 
 
#include "JobResult.h" 
 
class Job; 
 
class MandelbrotCalculator : public QObject 
{ 
    Q_OBJECT 
public: 
    explicit MandelbrotCalculator(QObject *parent = 0); 
    void init(QSize imageSize); 
 
private: 
    QPointF mMoveOffset; 
    double mScaleFactor; 
    QSize mAreaSize; 
    int mIterationMax; 
    int mReceivedJobResults; 
    QList<JobResult> mJobResults; 
    QElapsedTimer mTimer; 
}; 

We have already discussed mMoveOffsetmScaleFactormAreaSize, and  ...

Get End to End GUI Development with Qt5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.