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.hxx | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'tasklist.hxx') diff --git a/tasklist.hxx b/tasklist.hxx index a632d86..68cc3ff 100644 --- a/tasklist.hxx +++ b/tasklist.hxx @@ -2,19 +2,16 @@ #define TASKLIST_HXX #include +#include "rtticket.h" class Task { public: - Task(unsigned int id, QString subject) - : m_id{id} - , m_subject{subject} + Task(QString subject) : m_subject{subject} {} - unsigned int id() const { return m_id; } QString const& subject() const { return m_subject; } private: - unsigned int m_id; QString m_subject; }; @@ -25,11 +22,14 @@ class TaskList : public QAbstractListModel public: enum TaskRoles { - IdRole = Qt::UserRole + 1, - SubjectRole + SubjectRole = Qt::UserRole + 1, }; + explicit TaskList(QObject* parent = nullptr) : QAbstractListModel{parent} {} + ~TaskList() {} + inline static int typeId; + int rowCount(QModelIndex const& parent = QModelIndex()) const Q_DECL_OVERRIDE; QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; @@ -37,11 +37,15 @@ class TaskList : public QAbstractListModel QHash roleNames() const Q_DECL_OVERRIDE; signals: + void didAddProducts(); void rowCountChanged(); private: QList tasks; void addTask(Task const& task); + + private slots: + void addTasks(rt_ticketlist* taskList); }; #endif // TASKLIST_HXX -- cgit v1.2.3