|
|
|
@ -289,21 +289,24 @@ CSMWorld::DeleteNestedCommand::DeleteNestedCommand (IdTree& model,
|
|
|
|
|
std::string title =
|
|
|
|
|
model.headerData(parentColumn, Qt::Horizontal, Qt::DisplayRole).toString().toUtf8().constData();
|
|
|
|
|
setText (("Delete row in " + title + " sub-table of " + mId).c_str());
|
|
|
|
|
|
|
|
|
|
QModelIndex parentIndex = mModel.getModelIndex(mId, mParentColumn);
|
|
|
|
|
mModifyParentCommand = new ModifyCommand(mModel, parentIndex, parentIndex.data(Qt::EditRole), this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSMWorld::DeleteNestedCommand::redo()
|
|
|
|
|
{
|
|
|
|
|
const QModelIndex& parentIndex = mModel.getModelIndex(mId, mParentColumn);
|
|
|
|
|
|
|
|
|
|
QModelIndex parentIndex = mModel.getModelIndex(mId, mParentColumn);
|
|
|
|
|
mModel.removeRows (mNestedRow, 1, parentIndex);
|
|
|
|
|
mModifyParentCommand->redo();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CSMWorld::DeleteNestedCommand::undo()
|
|
|
|
|
{
|
|
|
|
|
const QModelIndex& parentIndex = mModel.getModelIndex(mId, mParentColumn);
|
|
|
|
|
|
|
|
|
|
QModelIndex parentIndex = mModel.getModelIndex(mId, mParentColumn);
|
|
|
|
|
mModel.setNestedTable(parentIndex, getOld());
|
|
|
|
|
mModifyParentCommand->undo();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CSMWorld::AddNestedCommand::AddNestedCommand(IdTree& model, const std::string& id, int nestedRow, int parentColumn, QUndoCommand* parent)
|
|
|
|
@ -317,20 +320,23 @@ CSMWorld::AddNestedCommand::AddNestedCommand(IdTree& model, const std::string& i
|
|
|
|
|
std::string title =
|
|
|
|
|
model.headerData(parentColumn, Qt::Horizontal, Qt::DisplayRole).toString().toUtf8().constData();
|
|
|
|
|
setText (("Add row in " + title + " sub-table of " + mId).c_str());
|
|
|
|
|
|
|
|
|
|
QModelIndex parentIndex = mModel.getModelIndex(mId, mParentColumn);
|
|
|
|
|
mModifyParentCommand = new ModifyCommand(mModel, parentIndex, parentIndex.data(Qt::EditRole), this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSMWorld::AddNestedCommand::redo()
|
|
|
|
|
{
|
|
|
|
|
const QModelIndex& parentIndex = mModel.getModelIndex(mId, mParentColumn);
|
|
|
|
|
|
|
|
|
|
QModelIndex parentIndex = mModel.getModelIndex(mId, mParentColumn);
|
|
|
|
|
mModel.addNestedRow (parentIndex, mNewRow);
|
|
|
|
|
mModifyParentCommand->redo();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSMWorld::AddNestedCommand::undo()
|
|
|
|
|
{
|
|
|
|
|
const QModelIndex& parentIndex = mModel.getModelIndex(mId, mParentColumn);
|
|
|
|
|
|
|
|
|
|
QModelIndex parentIndex = mModel.getModelIndex(mId, mParentColumn);
|
|
|
|
|
mModel.setNestedTable(parentIndex, getOld());
|
|
|
|
|
mModifyParentCommand->undo();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CSMWorld::NestedTableStoring::NestedTableStoring(const IdTree& model, const std::string& id, int parentColumn)
|
|
|
|
|