| 54 | |
| 55 | |
| 56 | QVariant CommitTableModel::data(const QModelIndex &index, int role) const |
| 57 | // ---------------------------------------------------------------------------- |
| 58 | // Return the model data for a given element of the table |
| 59 | // ---------------------------------------------------------------------------- |
| 60 | { |
| 61 | if (!index.isValid() || |
| 62 | index.row() >= commits.size() || |
| 63 | index.row() < 0) |
| 64 | return QVariant(); |
| 65 | |
| 66 | if (role == Qt::DisplayRole) |
| 67 | { |
| 68 | Repository::Commit commit = commits.at(index.row()); |
| 69 | |
| 70 | switch (index.column()) |
| 71 | { |
| 72 | case 0: return commit.id; |
| 73 | case 1: return commit.date; |
| 74 | case 2: return commit.author; |
| 75 | case 3: return commit.msg; |
| 76 | default: return QVariant(); |
| 77 | } |
| 78 | } |
| 79 | return QVariant(); |
| 80 | } |
| 81 | |
| 82 | |
| 83 | QVariant CommitTableModel::headerData(int section, Qt::Orientation orientation, |
no test coverage detected