mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-17 10:10:23 +00:00
Don't do any storing in the constructor
This commit is contained in:
parent
45549da0f5
commit
b2fe591590
@ -190,10 +190,14 @@ CSMWorld::ModifyCommand::ModifyCommand (QAbstractItemModel& model, const QModelI
|
||||
const QVariant& new_, QUndoCommand* parent)
|
||||
: QUndoCommand (parent), mModel (&model), mIndex (index), mNew (new_), mHasRecordState(false), mOldRecordState(CSMWorld::RecordBase::State_BaseOnly)
|
||||
{
|
||||
if (QAbstractProxyModel *proxy = dynamic_cast<QAbstractProxyModel *> (&model))
|
||||
}
|
||||
|
||||
void CSMWorld::ModifyCommand::redo()
|
||||
{
|
||||
if (QAbstractProxyModel *proxy = dynamic_cast<QAbstractProxyModel *> (mModel))
|
||||
{
|
||||
// Replace proxy with actual model
|
||||
mIndex = proxy->mapToSource (index);
|
||||
mIndex = proxy->mapToSource (mIndex);
|
||||
mModel = proxy->sourceModel();
|
||||
}
|
||||
|
||||
@ -223,10 +227,7 @@ CSMWorld::ModifyCommand::ModifyCommand (QAbstractItemModel& model, const QModelI
|
||||
mRecordStateIndex = table->index(rowIndex, stateColumnIndex);
|
||||
mOldRecordState = static_cast<CSMWorld::RecordBase::State>(table->data(mRecordStateIndex).toInt());
|
||||
}
|
||||
}
|
||||
|
||||
void CSMWorld::ModifyCommand::redo()
|
||||
{
|
||||
mOld = mModel->data (mIndex, Qt::EditRole);
|
||||
mModel->setData (mIndex, mNew);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user