qml demo
This commit is contained in:
28
src/main.cpp
28
src/main.cpp
@@ -1,9 +1,31 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <QGuiApplication>
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QQmlContext>
|
||||
|
||||
#include "TimerComponent.hpp"
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
|
||||
std::cout << "hi mom !" << std::endl;
|
||||
// create application
|
||||
QGuiApplication app(argc, argv);
|
||||
QQmlApplicationEngine engine;
|
||||
|
||||
return 0;
|
||||
}
|
||||
// attach backend gui components
|
||||
qmlRegisterType<TimerComponent>("AppDemo", 1, 0, "TimerComponent");
|
||||
|
||||
// load qml
|
||||
//engine.loadFromModule("sonobulus", "Main");
|
||||
//engine.load(QUrl("qrc:/Main.qml"));
|
||||
engine.load(QUrl::fromLocalFile("src/Main.qml")); // ugh
|
||||
|
||||
if(engine.rootObjects().isEmpty()) {
|
||||
std::cout << "engine is empty" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// execute app
|
||||
return app.exec();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user