From 9ec42c7e9c4a96d54bbf526cbd93f07c78e2415e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=20=EA=A6=AB=EA=A6=B6=20=EA=A6=8F=EA=A7=80?= =?UTF-8?q?=EA=A6=A6=EA=A6=BF=20=EA=A6=A7=20=EA=A6=AE=20=EA=A6=91=20?= =?UTF-8?q?=EA=A6=A9=20=EA=A6=AD=EA=A7=80?= Date: Fri, 13 Sep 2019 18:29:31 +0800 Subject: Manage to show tasks but the view is widened vertically yet. --- main.cxx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'main.cxx') diff --git a/main.cxx b/main.cxx index c9e8691..ff184e7 100644 --- a/main.cxx +++ b/main.cxx @@ -1,6 +1,5 @@ #include #include -#include #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("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}; -- cgit v1.2.3