parent
828e0ba144
commit
6bd460f88c
Binary file not shown.
@ -1,20 +1,28 @@
|
||||
#include <QApplication>
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QQmlContext>
|
||||
#include <QTranslator>
|
||||
#include <QDebug>
|
||||
#include "myclass.h"
|
||||
//#include <QDebug>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
|
||||
// Localization
|
||||
QString locale = QLocale::system().name();
|
||||
qDebug() << "Locale: " + locale;
|
||||
|
||||
QTranslator translator;
|
||||
translator.load("2048-qt_" + locale);
|
||||
app.installTranslator(&translator);
|
||||
|
||||
QQmlApplicationEngine engine;
|
||||
engine.load(QUrl(QStringLiteral("qrc:///qml/main.qml")));
|
||||
|
||||
MyClass myClass;
|
||||
|
||||
// qDebug() << engine.rootObjects().length();
|
||||
QObject *mainWindow = engine.rootObjects()[0];
|
||||
QObject::connect(mainWindow, SIGNAL(helpMenuTriggered()), &myClass, SLOT(aboutQt()));
|
||||
// Access C++ object "myClass" from QML as "myClass"
|
||||
engine.rootContext()->setContextProperty("myClass", &myClass);
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
|
Loading…
Reference in new issue