-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
28 lines (21 loc) · 682 Bytes
/
main.cpp
File metadata and controls
28 lines (21 loc) · 682 Bytes
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
#include <QApplication>
#include <QThread>
#include "mainwindow.h"
#include "olaworker.h"
int main(int argc, char *argv[]) {
QApplication a(argc, argv);
QThread *thread = new QThread;
OLAWorker *worker = new OLAWorker();
if (!worker->Init()) {
return -1;
}
worker->moveToThread(thread);
QObject::connect(thread, SIGNAL(started()), worker, SLOT(process()));
QObject::connect(worker, SIGNAL(finished()), thread, SLOT(quit()));
QObject::connect(worker, SIGNAL(finished()), worker, SLOT(deleteLater()));
QObject::connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
MainWindow w(worker);
thread->start();
w.show();
return a.exec();
}