-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathreceiver.cpp
37 lines (30 loc) · 935 Bytes
/
receiver.cpp
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
#include "receiver.h"
#include <QDebug>
#include "QProcess"
#include "QFileInfo"
#include "systemcommand.h"
#include "QThread"
#include "worker.h"
Receiver::Receiver(QObject *parent) :
QObject(parent)
{
}
void Receiver::receiveFromQml(int count) {
qDebug() << "RECIVER: Received in C++ from QML:" << count;
}
void Receiver::runbackgroundcmd() {
QThread* thread = new QThread;
Worker* worker = new Worker();
worker->moveToThread(thread);
connect(worker, SIGNAL(error(QString)), this, SLOT(errorString(QString)));
connect(thread, SIGNAL(started()), worker, SLOT(process()));
connect(worker, SIGNAL(finished()), thread, SLOT(quit()));
connect(worker, SIGNAL(finished()), worker, SLOT(deleteLater()));
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
thread->start();
}
void Receiver::errorString(QString error) {
qDebug() << error;
}
void Receiver::readOutput() {
}