diff options
author | Erik Prabowo Kamal <erik@darapsa.co.id> | 2019-08-29 15:30:00 +0800 |
---|---|---|
committer | Erik Prabowo Kamal <erik@darapsa.co.id> | 2019-08-29 15:30:00 +0800 |
commit | c8891b50d1f30c7c07bf96f8eaf2e1002ce573b8 (patch) | |
tree | 6e3023aa0b11da7a0ccdb00c33d911e4a5aa3d69 /controller.cxx | |
parent | 938ea55a0a272b6fd1e35ee383c1f444cdbebf05 (diff) |
Set up a way for the thread to quit
Diffstat (limited to 'controller.cxx')
-rw-r--r-- | controller.cxx | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/controller.cxx b/controller.cxx new file mode 100644 index 0000000..d1271b9 --- /dev/null +++ b/controller.cxx @@ -0,0 +1,16 @@ +#include "worker.hxx" +#include "controller.hxx" + +Controller::Controller() +{ + Worker* worker = new Worker{}; + worker->moveToThread(&thread); + connect(&thread, &QThread::finished, worker, &QObject::deleteLater); + thread.start(); +} + +Controller::~Controller() +{ + thread.quit(); + thread.wait(); +} |