2019-04-03 06:07:15 +02:00
|
|
|
#include <QApplication>
|
2019-04-04 07:32:15 +02:00
|
|
|
#include <QFontDatabase>
|
2019-04-03 06:07:15 +02:00
|
|
|
#include <QQmlApplicationEngine>
|
|
|
|
#include <QQmlContext>
|
|
|
|
#include "calculator.h"
|
|
|
|
|
|
|
|
int main(int argc, char** argv)
|
|
|
|
{
|
|
|
|
QApplication app(argc, argv);
|
2019-04-04 06:33:42 +02:00
|
|
|
|
2019-04-04 08:04:20 +02:00
|
|
|
//QML engine
|
2019-04-03 06:07:15 +02:00
|
|
|
QQmlApplicationEngine engine;
|
|
|
|
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
|
|
|
|
|
2019-04-04 08:04:20 +02:00
|
|
|
//calculator
|
2019-04-03 06:07:15 +02:00
|
|
|
Calculator calculator;
|
|
|
|
engine.rootContext()->setContextProperty("_calculator", &calculator);
|
2019-04-04 06:33:42 +02:00
|
|
|
|
2019-04-04 08:04:20 +02:00
|
|
|
//fixed-width font for LCD
|
2019-04-04 07:32:15 +02:00
|
|
|
QFont fixedFont = QFontDatabase::systemFont(QFontDatabase::FixedFont);
|
|
|
|
fixedFont.setStyleHint(QFont::TypeWriter);
|
2019-04-04 08:46:10 +02:00
|
|
|
fixedFont.setPointSize(24);
|
2019-04-04 07:32:15 +02:00
|
|
|
engine.rootContext()->setContextProperty("_fixedFont", fixedFont);
|
|
|
|
|
2019-04-04 08:04:20 +02:00
|
|
|
//handle quit
|
|
|
|
QObject::connect(&app, &QApplication::aboutToQuit, &calculator, &Calculator::quit);
|
|
|
|
|
2019-04-03 06:07:15 +02:00
|
|
|
return app.exec();
|
|
|
|
}
|