From 9ec42c7e9c4a96d54bbf526cbd93f07c78e2415e Mon Sep 17 00:00:00 2001 From: ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ 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.3