blob: ec6627e65b8c9aed4ba219ef7259b3fd6658c069 [file] [log] [blame]
swissChili23958ca2022-02-21 19:23:34 -08001#include "IdeMain.h"
2
3#include <QQmlApplicationEngine>
4#include <QQuickStyle>
5
swissChili25620b02022-02-23 17:15:16 -08006#include "CellModel.h"
7
swissChili23958ca2022-02-21 19:23:34 -08008int ideMain(QGuiApplication *app)
9{
swissChilie386bc72022-02-24 21:31:31 -080010#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
11 QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
12#endif
13
swissChili23958ca2022-02-21 19:23:34 -080014 QQmlApplicationEngine engine;
15
swissChili23958ca2022-02-21 19:23:34 -080016 QQuickStyle::setStyle("Material");
17
swissChili25620b02022-02-23 17:15:16 -080018 qRegisterMetaType<CellModel>();
19 qRegisterMetaType<CellModel *>();
20
swissChili23958ca2022-02-21 19:23:34 -080021 const QUrl url(QStringLiteral("qrc:/qml/main.qml"));
22 QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
23 app, [url](QObject *obj, const QUrl &objUrl)
24 {
25 if (!obj && url == objUrl)
26 QCoreApplication::exit(-1);
27 }, Qt::QueuedConnection);
28 engine.load(url);
29
30 return app->exec();
31}