1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-01 09:45:35 +00:00

move code for storing old value from ModifyCommand constructor to redo function (allows use of the command on records that haven't been created at the time of construction)

This commit is contained in:
Marc Zinnschlag 2014-09-18 11:37:23 +02:00
parent 70275350de
commit 33243c8c16

View file

@ -10,13 +10,12 @@ CSMWorld::ModifyCommand::ModifyCommand (QAbstractItemModel& model, const QModelI
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()
{
mOld = mModel.data (mIndex, Qt::EditRole);
mModel.setData (mIndex, mNew);
}