mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 02:19:55 +00:00
23 lines
No EOL
580 B
C++
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);
|
|
} |