| 17 | } |
| 18 | |
| 19 | QVariant TaskModel::data(const QModelIndex &index, int role) const |
| 20 | { |
| 21 | if (!index.isValid() || !m_flow || index.row() >= m_flow->tasks().size()) |
| 22 | return QVariant(); |
| 23 | |
| 24 | const auto &task = m_flow->tasks().values(); |
| 25 | |
| 26 | switch (role) { |
| 27 | case TaskRoles::TaskIdRole: |
| 28 | return task.at(index.row())->taskId(); |
| 29 | case TaskRoles::TaskDataRole: |
| 30 | return QVariant::fromValue(task.at(index.row())); |
| 31 | default: |
| 32 | return QVariant(); |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | QHash<int, QByteArray> TaskModel::roleNames() const |
| 37 | { |