Page MenuHomePhorge

threadcontroller.cpp
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

threadcontroller.cpp

#include "threadcontroller.h"
#include "worker.h"
ThreadController::ThreadController(QObject *parent) : QObject(parent)
{
Worker *worker = new Worker;
worker->moveToThread(&this->workerThread);
this->workerThread.setObjectName("workerThread");
connect(&this->workerThread,SIGNAL(finished()), worker, SLOT(deleteLater()));
connect(this, SIGNAL(finished()), &this->workerThread, SLOT(quit()));
connect(this, SIGNAL(finished()), worker, SLOT(deleteLater()));
connect(this, SIGNAL(operate(const QString&)), worker, SLOT(doParallelAlgorithm(const QString&)));
connect(worker, SIGNAL(resultReady(const QString&)), this, SLOT(handleResults(const QString&)));
connect(&this->workerThread, SIGNAL(finished()), this, SLOT(closeApplication()));
this->workerThread.start();
emit operate("doParallel Multitrheading");
}
ThreadController::~ThreadController()
{
}
void ThreadController::handleResults(const QString& parameter)
{
qDebug() << "Handling results";
qDebug() << parameter;
emit finished();
}
void ThreadController::closeApplication()
{
QCoreApplication::quit();
}

File Metadata

Mime Type
text/x-c
Expires
Sat, Aug 29, 4:07 PM (1 d, 6 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
368980
Default Alt Text
threadcontroller.cpp (1 KB)

Event Timeline