| 75 | } |
| 76 | |
| 77 | bool MacroStepTableModel::setData(const QModelIndex &index, const QVariant &value, int role) |
| 78 | { |
| 79 | if (!index.isValid()) |
| 80 | return false; |
| 81 | |
| 82 | if (role == Qt::EditRole) { |
| 83 | switch (index.column()) { |
| 84 | case 0: { |
| 85 | Scintilla::Message newMessage = static_cast<Scintilla::Message>(value.toInt()); |
| 86 | MacroStep &m = macro->getSteps()[index.row()]; |
| 87 | |
| 88 | m.message = newMessage; |
| 89 | |
| 90 | if (!MacroStep::MessageHasString(newMessage)) { |
| 91 | m.str.clear(); |
| 92 | } |
| 93 | |
| 94 | emit dataChanged(index, index, QVector<int>() << role); |
| 95 | |
| 96 | return true; |
| 97 | } |
| 98 | case 1: |
| 99 | macro->getSteps()[index.row()].str = value.toString().toUtf8(); |
| 100 | |
| 101 | emit dataChanged(index, index, QVector<int>() << role); |
| 102 | |
| 103 | return true; |
| 104 | default: |
| 105 | break; |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | return false; |
| 110 | } |
| 111 | |
| 112 | bool MacroStepTableModel::insertRows(int row, int count, const QModelIndex &parent) |
| 113 | { |
no test coverage detected