Deleting items from the model can now be made undone/redone.
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
|
||||
#include "../formats/jsonparser.h"
|
||||
#include "commands/insertrowscommand.h"
|
||||
#include "commands/removerowscommand.h"
|
||||
#include "modelitem.h"
|
||||
|
||||
QHash<int, QByteArray> TableModel::ROLE_NAMES = {{NameRole, "Name"},
|
||||
@ -108,9 +109,8 @@ bool TableModel::removeRows(int firstRow, int nRows, const QModelIndex& parentIn
|
||||
return false;
|
||||
}
|
||||
|
||||
beginRemoveRows(QModelIndex(), firstRow, lastRow);
|
||||
m_items.remove(firstRow, nRows);
|
||||
endRemoveRows();
|
||||
RemoveRowsCommand* removeCommand = new RemoveRowsCommand(this, firstRow, nRows);
|
||||
m_undoStack->push(removeCommand);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user