-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloadingthread.cpp
More file actions
58 lines (47 loc) · 1.14 KB
/
Copy pathloadingthread.cpp
File metadata and controls
58 lines (47 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include "loadingthread.h"
#include <QtCore>
#include <QNetworkAccessManager>
#include <QtNetwork>
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QNetworkAccessManager>
#include <QLineSeries>
#include <QtCharts>
#include <QObject>
#include <QString>
#include <QStringList>
#define SAMPLE_NUM 5000
QUrl url;
QString localReply;
int networkIsRunningFor = 0;
loadingThread::loadingThread(QObject *parent)
{
}
void loadingThread::run()
{
QLineSeries *series = new QLineSeries();
qDebug() << "run";
QStringList replyList;
while(work)
{
if(calculate)
{
calculate = false;
QRegExp rx("[ ]");
replyList = localReply.split(rx, QString::SkipEmptyParts);
series->clear();
series->blockSignals(true);
for(int i = 0; i < replyList.length(); i++){
*series << QPointF(i, replyList[i].toUShort());
}
series->blockSignals(false);
emit dataChanged(series);
qDebug() << "11";
}
msleep(100);
}
}
void loadingThread::calculateGraph(QString reply)
{
localReply = reply;
}