swissChili | 23958ca | 2022-02-21 19:23:34 -0800 | [diff] [blame] | 1 | #include "IdeMain.h" |
| 2 | |
| 3 | #include <QQmlApplicationEngine> |
| 4 | #include <QQuickStyle> |
| 5 | |
swissChili | 25620b0 | 2022-02-23 17:15:16 -0800 | [diff] [blame] | 6 | #include "CellModel.h" |
| 7 | |
swissChili | 23958ca | 2022-02-21 19:23:34 -0800 | [diff] [blame] | 8 | int ideMain(QGuiApplication *app) |
| 9 | { |
swissChili | e386bc7 | 2022-02-24 21:31:31 -0800 | [diff] [blame] | 10 | #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) |
| 11 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); |
| 12 | #endif |
| 13 | |
swissChili | 23958ca | 2022-02-21 19:23:34 -0800 | [diff] [blame] | 14 | QQmlApplicationEngine engine; |
| 15 | |
swissChili | 23958ca | 2022-02-21 19:23:34 -0800 | [diff] [blame] | 16 | QQuickStyle::setStyle("Material"); |
| 17 | |
swissChili | 25620b0 | 2022-02-23 17:15:16 -0800 | [diff] [blame] | 18 | qRegisterMetaType<CellModel>(); |
| 19 | qRegisterMetaType<CellModel *>(); |
| 20 | |
swissChili | 23958ca | 2022-02-21 19:23:34 -0800 | [diff] [blame] | 21 | 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 | } |