#include #include #include "qappctrl.h" #define _APP_ID GFA_APPCTRL_APPID_USER_01 #define _APP_NAME "qmlApp" #define _UPDATE_TIMER_INT 50 #define _UPDATE_TIMER_INT_HEAVY_LOAD 5000 int main(int argc, char *argv[]) { int nRet = -1; QGfaAppCtrl appCtrl; QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QGuiApplication app(argc, argv); QQmlApplicationEngine engine; // const QUrl url(QStringLiteral("qrc:/main.qml")); const QUrl url(QStringLiteral("qrc:/dev.qml")); if(appCtrl.Create(_APP_ID, _APP_NAME, _UPDATE_TIMER_INT, _UPDATE_TIMER_INT_HEAVY_LOAD)) { appCtrl.SubscribeStateEvents(GFA_APPCTRL_APPID_ALL_GFA); appCtrl.SetState(GIAS_Initializing); QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, &app, [url, &appCtrl](QObject *obj, const QUrl &objUrl) { if (!obj && url == objUrl) { appCtrl.SetState(GIAS_Terminating); appCtrl.Release(); QCoreApplication::exit(-1); } }, Qt::QueuedConnection); appCtrl.RegisterQmlTypes(engine, 1, 0); engine.load(url); appCtrl.SetState(GIAS_Running); nRet = app.exec(); appCtrl.SetState(GIAS_Terminating); } return nRet; }