Adding new items to the model can now be made undone/redone.

This commit is contained in:
2025-12-11 15:46:28 +01:00
parent 432e81d4be
commit 0166a00d9d
7 changed files with 114 additions and 18 deletions

View File

@ -19,7 +19,8 @@ using namespace std;
GenericCore::GenericCore() {
qDebug() << "Creating core...";
m_modelUndoStack = make_shared<QUndoStack>(this);
// TODO let the model own its undo stack (& use TableModel::getUndoStack() if necessary)
m_modelUndoStack = new QUndoStack(this);
setupModels();
}
@ -74,12 +75,12 @@ void GenericCore::triggerApplicationUpdate() {
QProcess::startDetached(toolFilePath, args);
}
std::shared_ptr<QUndoStack> GenericCore::getModUndoStack() const { return m_modelUndoStack; }
QUndoStack* GenericCore::getModelUndoStack() const { return m_modelUndoStack; }
std::shared_ptr<TableModel> GenericCore::getModel() const { return m_mainModel; }
void GenericCore::setupModels() {
m_mainModel = make_shared<TableModel>(this);
m_mainModel = make_shared<TableModel>(m_modelUndoStack, this);
// TODO add QAbstractItemModelTester
}