#include #include #include #include "myhalclass.h" int main(int argc, char *argv[]) { QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QGuiApplication app(argc, argv); MyHalClass halObj; QThread halThread; halObj.moveToThread(&halThread); QObject::connect(&halThread, &QThread::started, &halObj, &MyHalClass::startHal); QObject::connect(&halThread, &QThread::finished, &halObj, &MyHalClass::deleteLater); QObject::connect(&app, &QCoreApplication::aboutToQuit, &halThread, &QThread::quit); halThread.start(); QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); if (engine.rootObjects().isEmpty()) return -1; return app.exec(); }