diff options
Diffstat (limited to 'main.cxx')
-rw-r--r-- | main.cxx | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -1,6 +1,5 @@ #include <QGuiApplication> #include <QQmlApplicationEngine> -#include <QtQml> #include "user.hxx" #include "tasklist.hxx" #include "controller.hxx" @@ -16,11 +15,16 @@ int main(int argc, char* argv[]) QJSEngine *scriptEngine) -> QObject* { Q_UNUSED(engine) Q_UNUSED(scriptEngine) - return new User{}; + return new User; }); - TaskList taskList; - engine.rootContext()->setContextProperty("taskList", &taskList); + TaskList::typeId = qmlRegisterSingletonType<User>("KelakonUser", 0, 1, "TaskList" + , [](QQmlEngine *engine, + QJSEngine *scriptEngine) -> QObject* { + Q_UNUSED(engine) + Q_UNUSED(scriptEngine) + return new TaskList; + }); engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); Controller controller{&engine}; |