qmlfrontend/main.cpp
branchtransitional_engine
changeset 16051 2003b466b279
parent 16039 a73b9770467a
equal deleted inserted replaced
16050:6a3dc15b78b9 16051:2003b466b279
    16   PreviewAcceptor* acceptor = new PreviewAcceptor(engine);
    16   PreviewAcceptor* acceptor = new PreviewAcceptor(engine);
    17   return acceptor;
    17   return acceptor;
    18 }
    18 }
    19 
    19 
    20 int main(int argc, char* argv[]) {
    20 int main(int argc, char* argv[]) {
    21   QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
       
    22   QGuiApplication app(argc, argv);
    21   QGuiApplication app(argc, argv);
    23 
    22 
    24   QQmlApplicationEngine engine;
    23   QQmlApplicationEngine engine;
    25 
    24 
    26   qRegisterMetaType<Engine::SimpleEventType>();
    25   qRegisterMetaType<Engine::SimpleEventType>();
    32       "Hedgewars.Engine", 1, 0, "PreviewAcceptor",
    31       "Hedgewars.Engine", 1, 0, "PreviewAcceptor",
    33       previewacceptor_singletontype_provider);
    32       previewacceptor_singletontype_provider);
    34   qmlRegisterType<HWEngine>("Hedgewars.Engine", 1, 0, "HWEngine");
    33   qmlRegisterType<HWEngine>("Hedgewars.Engine", 1, 0, "HWEngine");
    35   qmlRegisterType<GameView>("Hedgewars.Engine", 1, 0, "GameView");
    34   qmlRegisterType<GameView>("Hedgewars.Engine", 1, 0, "GameView");
    36   qmlRegisterType<NetSession>("Hedgewars.Engine", 1, 0, "NetSession");
    35   qmlRegisterType<NetSession>("Hedgewars.Engine", 1, 0, "NetSession");
    37   qmlRegisterUncreatableType<EngineInstance>("Hedgewars.Engine", 1, 0,
    36   qmlRegisterUncreatableType<EngineInstance>(
    38                                              "EngineInstance",
    37       "Hedgewars.Engine", 1, 0, "EngineInstance",
    39                                              "Create by HWEngine run methods");
    38       QStringLiteral("Create by HWEngine run methods"));
    40 
    39 
    41   qmlRegisterUncreatableMetaObject(Engine::staticMetaObject, "Hedgewars.Engine",
    40   qmlRegisterUncreatableMetaObject(Engine::staticMetaObject, "Hedgewars.Engine",
    42                                    1, 0, "Engine", "Namespace: only enums");
    41                                    1, 0, "Engine",
       
    42                                    QStringLiteral("Namespace: only enums"));
    43 
    43 
    44   engine.load(QUrl(QLatin1String("qrc:/main.qml")));
    44   engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
    45   if (engine.rootObjects().isEmpty()) return -1;
    45   if (engine.rootObjects().isEmpty()) return -1;
    46 
    46 
    47   return app.exec();
    47   return app.exec();
    48 }
    48 }