1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 01:23:53 +00:00
openmw/apps/opencs/model/world/commands.cpp
2012-11-29 16:05:28 +01:00

23 lines
No EOL
580 B
C++

#include "commands.hpp"
#include <QAbstractTableModel>
CSMWorld::ModifyCommand::ModifyCommand (QAbstractItemModel& model, const QModelIndex& index,
const QVariant& new_, QUndoCommand *parent)
: QUndoCommand (parent), mModel (model), mIndex (index), mNew (new_)
{
mOld = mModel.data (mIndex, Qt::EditRole);
setText ("Modify " + mModel.headerData (mIndex.column(), Qt::Horizontal, Qt::DisplayRole).toString());
}
void CSMWorld::ModifyCommand::redo()
{
mModel.setData (mIndex, mNew);
}
void CSMWorld::ModifyCommand::undo()
{
mModel.setData (mIndex, mOld);
}