| 88 | } |
| 89 | |
| 90 | QVariant GameOptions::data(const QModelIndex& index, int role) const |
| 91 | { |
| 92 | if (!index.isValid()) |
| 93 | return QVariant(); |
| 94 | |
| 95 | int row = index.row(); |
| 96 | int column = index.column(); |
| 97 | |
| 98 | if (row < 0 || row >= int(contents.size())) |
| 99 | return QVariant(); |
| 100 | |
| 101 | switch (role) |
| 102 | { |
| 103 | case Qt::DisplayRole: |
| 104 | if(column == 0) |
| 105 | { |
| 106 | return contents[row].key; |
| 107 | } |
| 108 | else |
| 109 | { |
| 110 | return contents[row].value; |
| 111 | } |
| 112 | default: |
| 113 | return QVariant(); |
| 114 | } |
| 115 | return QVariant(); |
| 116 | } |
| 117 | |
| 118 | int GameOptions::rowCount(const QModelIndex&) const |
| 119 | { |