| 32 | } |
| 33 | |
| 34 | bool PresetRuleTableModel::setData(const QModelIndex &index, const QVariant &value, int role) |
| 35 | { |
| 36 | if (role == Qt::EditRole) { |
| 37 | #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) |
| 38 | if (!checkIndex(index)) |
| 39 | return false; |
| 40 | #endif |
| 41 | |
| 42 | auto backup = rules[index.row()]; |
| 43 | |
| 44 | switch (index.column()) { |
| 45 | case 2: |
| 46 | rules[index.row()].preset = value.toString(); |
| 47 | break; |
| 48 | }; |
| 49 | |
| 50 | /* No change */ |
| 51 | if(backup == rules[index.row()]) |
| 52 | return false; |
| 53 | |
| 54 | emit dataChanged(index, index.sibling(index.row(), 2)); |
| 55 | return true; |
| 56 | } |
| 57 | return false; |
| 58 | } |
| 59 | |
| 60 | QVariant PresetRuleTableModel::data(const QModelIndex &index, int role) const |
| 61 | { |
no outgoing calls
no test coverage detected