问题背景
qt版本:5.15.2
使用QThreadPool
创建了线程mywork
,在他的虚函数run
中进行绘图。
代码
mywork.h
#ifndef MYWORK_H
#define MYWORK_H
#include <QObject>
#include <QRunnable>
#include <QtCharts>
class mywork : public QObject, public QRunnable
{
Q_OBJECT
public:
explicit mywork(QObject *parent = nullptr);
~mywork();
void run() override;
signals:
void end();
public slots:
void setchart(QChartView *c, QChart *&chart, QValueAxis *&aX, QValueAxis *&aY, QScatterSeries *s);
private:
QChartView *chartView=nullptr;
QChart *chartsatvis=nullptr;
QValueAxis *aXsatvis=nullptr;
QValueAxis *aYsatvis=