diff options
author | ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id> | 2019-09-13 18:29:31 +0800 |
---|---|---|
committer | ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id> | 2019-09-13 18:29:31 +0800 |
commit | 9ec42c7e9c4a96d54bbf526cbd93f07c78e2415e (patch) | |
tree | 422e087574a93d29edf689189c23b0949d4a3449 /main.cxx | |
parent | 7e4501b3af82360eb1415f3d5745f1b0c278f504 (diff) |
Manage to show tasks
but the view is widened vertically yet.
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}; |