#include #include #include #include #include #include #include "test.h" int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); QQmlApplicationEngine engine("qrc:/org/yachat/lib/Main.qml"); #if 0 qRegisterMetaType("Test"); qmlRegisterType("org.yachat.lib", 1, 0, "Test"); #endif #if 1 qmlRegisterSingletonType("org.yachat.lib", 1, 0, "Test", [](QQmlEngine *, QJSEngine *) -> QObject * { return std::make_unique().release(); } ); #else Test test; engine.rootContext()->setContextProperty("Test", &test); #endif return app.exec(); }