summaryrefslogtreecommitdiff
path: root/controller.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'controller.cxx')
-rw-r--r--controller.cxx11
1 files changed, 8 insertions, 3 deletions
diff --git a/controller.cxx b/controller.cxx
index 4e518f4..757d475 100644
--- a/controller.cxx
+++ b/controller.cxx
@@ -1,14 +1,19 @@
+#include <QQmlApplicationEngine>
#include "worker.hxx"
#include "controller.hxx"
-Controller::Controller(QObject* parent) :
- QObject{parent}
+Controller::Controller(QObject* parent) : QObject{parent}
{
Worker* worker = new Worker{};
worker->moveToThread(&thread);
connect(&thread, &QThread::finished, worker, &QObject::deleteLater);
- connect(parent, SIGNAL(logIn(QString, QString)),
+
+ auto engine = dynamic_cast<QQmlApplicationEngine*>(parent);
+ auto rootObjects = engine->rootObjects();
+ auto appWindow = rootObjects[0];
+ connect(appWindow, SIGNAL(logIn(QString, QString)),
worker, SLOT(logIn(QString, QString)));
+
thread.start();
}