39 lines
1.2 KiB
C++
39 lines
1.2 KiB
C++
#include <QGuiApplication>
|
|
#include <QQmlApplicationEngine>
|
|
#include <QQmlContext>
|
|
#include <QUndoCommand>
|
|
|
|
#include "model/generalsortfiltermodel.h"
|
|
|
|
#include "genericcore.h"
|
|
|
|
#ifdef QT_DEBUG
|
|
#include "utils/messagehandler.h"
|
|
#endif
|
|
|
|
int main(int argc, char* argv[]) {
|
|
#ifdef QT_DEBUG
|
|
qInstallMessageHandler(consoleHandlerColoredVerboseInDarkTheme);
|
|
#endif
|
|
|
|
QGuiApplication app(argc, argv);
|
|
std::unique_ptr<GenericCore> core = std::make_unique<GenericCore>();
|
|
std::shared_ptr<GeneralSortFilterModel> mainModel = core->getSortFilterModel();
|
|
QUndoStack* undoStack = core->getModelUndoStack();
|
|
|
|
// qInfo() << "QMLApp Version:" << QMLAPP_VERSION;
|
|
qInfo() << "core->getString():" << core->toString();
|
|
|
|
QQmlApplicationEngine engine;
|
|
engine.rootContext()->setContextProperty(QStringLiteral("core"), core.get());
|
|
engine.rootContext()->setContextProperty(QStringLiteral("mainModel"), mainModel.get());
|
|
engine.rootContext()->setContextProperty(QStringLiteral("appUndoStack"), undoStack);
|
|
|
|
QObject::connect(
|
|
&engine, &QQmlApplicationEngine::objectCreationFailed, &app,
|
|
[]() { QCoreApplication::exit(-1); }, Qt::QueuedConnection);
|
|
engine.loadFromModule("GenericQML", "Main");
|
|
|
|
return app.exec();
|
|
}
|