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. --- tasklist.cxx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'tasklist.cxx') diff --git a/tasklist.cxx b/tasklist.cxx index 4810c5b..863ae23 100644 --- a/tasklist.cxx +++ b/tasklist.cxx @@ -14,8 +14,6 @@ QVariant TaskList::data(QModelIndex const& index, int role) const auto task = tasks[row]; switch (role) { - case IdRole: - return task.id(); case SubjectRole: return task.subject(); default: @@ -26,7 +24,6 @@ QVariant TaskList::data(QModelIndex const& index, int role) const QHash TaskList::roleNames() const { return QHash{ - {IdRole, "id"}, {SubjectRole, "subject"} }; } @@ -38,3 +35,13 @@ void TaskList::addTask(Task const& task) endInsertRows(); emit rowCountChanged(); } + +void TaskList::addTasks(rt_ticketlist* taskList) +{ + for (unsigned int i = 0; i < taskList->length; i++) { + auto task = taskList->tickets[i]; + addTask(Task{task}); + free(task); + } + free(taskList); +} -- cgit v1.2.3