virtual
| 85 | |
| 86 | // virtual |
| 87 | UndoStep* MapPartUndoStep::undo() |
| 88 | { |
| 89 | UndoStep* redo_step = nullptr; |
| 90 | switch (change) |
| 91 | { |
| 92 | case AddMapPart: |
| 93 | Q_ASSERT(map->getNumParts()+1 > index); |
| 94 | map->addPart(new MapPart(name, map), index); |
| 95 | redo_step = new MapPartUndoStep(map, RemoveMapPart, index); |
| 96 | break; |
| 97 | case RemoveMapPart: |
| 98 | Q_ASSERT(map->getPart(index)->getNumObjects() == 0); |
| 99 | redo_step = new MapPartUndoStep(map, AddMapPart, index); |
| 100 | map->removePart(index); |
| 101 | break; |
| 102 | case ModifyMapPart: |
| 103 | Q_ASSERT(map->getNumParts() > index); |
| 104 | redo_step = new MapPartUndoStep(map, ModifyMapPart, index); |
| 105 | map->getPart(index)->setName(name); |
| 106 | break; |
| 107 | case UndefinedChange: |
| 108 | Q_ASSERT(false); |
| 109 | redo_step = new NoOpUndoStep(map, true); |
| 110 | break; |
| 111 | // default: nothing left (but watch compiler warnings). |
| 112 | } |
| 113 | |
| 114 | Q_ASSERT(redo_step); |
| 115 | return redo_step; |
| 116 | } |
| 117 | |
| 118 | // virtual |
| 119 | bool MapPartUndoStep::getModifiedParts(PartSet &out) const |
nothing calls this directly
no test coverage detected