src/editHistory.cpp

changeset 1272
bf0ac547b934
parent 1269
ec691d9472b3
child 1273
900f1dfae46b
equal deleted inserted replaced
1271:c022fb3855b1 1272:bf0ac547b934
186 void EditHistoryEntry::redo() 186 void EditHistoryEntry::redo()
187 { 187 {
188 parent()->document()->setObjectAt(row, newState); 188 parent()->document()->setObjectAt(row, newState);
189 } 189 }
190 190
191 SwapHistoryEntry::SwapHistoryEntry (int a, int b, EditHistory* parent) : 191 SwapHistoryEntry::SwapHistoryEntry (const QModelIndex& index_1, const QModelIndex& index_2, EditHistory* parent) :
192 AbstractHistoryEntry {parent}, 192 AbstractHistoryEntry {parent},
193 m_a (a), 193 row_1 (index_1.row()),
194 m_b (b) {} 194 row_2 (index_2.row()) {}
195 195
196 196
197 void SwapHistoryEntry::undo() 197 void SwapHistoryEntry::undo()
198 { 198 {
199 parent()->document()->swapObjects(LDObject::fromID (m_a), LDObject::fromID (m_b)); 199 Model* model = parent()->document();
200 model->swapObjects(model->index(row_1), model->index(row_2));
200 } 201 }
201 202
202 void SwapHistoryEntry::redo() 203 void SwapHistoryEntry::redo()
203 { 204 {
204 undo(); 205 undo();

mercurial