QtDeployer/source/main.cpp

40 lines
920 B
C++
Raw Normal View History

2018-03-12 11:43:03 +03:30
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
2018-05-10 14:04:01 +03:00
#include <QIcon>
2018-03-12 11:43:03 +03:30
2018-05-07 19:33:05 +03:00
#include "CPP/cppmanager.h"
#include "CPP/mainmanager.h"
#include "CPP/outputmanager.h"
#include "CPP/pluginmanager.h"
#include "CPP/qmlmanager.h"
2018-03-12 11:43:03 +03:30
int main(int argc, char *argv[])
{
2018-05-10 12:36:59 +03:00
QGuiApplication app(argc, argv);
2018-03-12 11:43:03 +03:30
2018-05-10 14:04:01 +03:00
app.setWindowIcon(QIcon("://icon"));
2018-05-10 12:36:59 +03:00
CppManager C;
QmlManager Q;
PluginManager P;
OutputManager O;
2018-05-07 19:33:05 +03:00
2018-05-10 12:36:59 +03:00
MainManager M(&C, &Q, &O, &P);
2018-03-12 11:43:03 +03:30
2018-05-10 12:36:59 +03:00
QQmlApplicationEngine engine;
2018-03-12 11:43:03 +03:30
2018-05-10 12:36:59 +03:00
auto *R = engine.rootContext();
R->setContextProperty("CppManager", &C);
R->setContextProperty("QmlManager", &Q);
R->setContextProperty("PluginManager", &P);
R->setContextProperty("MainManager", &M);
R->setContextProperty("OutputManager", &O);
2018-05-07 19:33:05 +03:00
2018-03-12 11:43:03 +03:30
2018-05-10 12:36:59 +03:00
engine.load(QUrl(QLatin1String("qrc:/QML/main.qml")));
if (engine.rootObjects().isEmpty()) return -1;
2018-03-12 11:43:03 +03:30
2018-05-10 12:36:59 +03:00
return app.exec();
2018-03-12 11:43:03 +03:30
}