mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-20 05:53:50 +00:00
added setId to adapter
This commit is contained in:
parent
a45339bbe6
commit
38636fab9a
3 changed files with 12 additions and 0 deletions
|
@ -45,6 +45,9 @@ CSMWorld::CloneCommand::CloneCommand(CSMWorld::IdTable& model,
|
|||
void CSMWorld::CloneCommand::redo()
|
||||
{
|
||||
mModel.cloneRecord(mIdOrigin, mIdDestination, mArgumentType, mType);
|
||||
|
||||
for (std::map<int, QVariant>::const_iterator iter(mValues.begin()); iter != mValues.end(); ++iter)
|
||||
mModel.setData(mModel.getModelIndex(mIdDestination, iter->first), iter->second);
|
||||
}
|
||||
|
||||
void CSMWorld::CloneCommand::undo()
|
||||
|
|
|
@ -31,6 +31,7 @@ namespace CSMWorld
|
|||
///< If the data type does not match an exception is thrown.
|
||||
|
||||
virtual std::string getId (const RecordBase& record) const = 0;
|
||||
virtual void setId(RecordBase& record, const std::string& id) = 0;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,8 @@ namespace CSMWorld
|
|||
|
||||
virtual std::string getId (const RecordBase& record) const;
|
||||
|
||||
virtual void setId (RecordBase& record, const std::string& id);
|
||||
|
||||
virtual QVariant getData (const RefIdColumn *column, const RefIdData& data, int index)
|
||||
const;
|
||||
|
||||
|
@ -50,6 +52,12 @@ namespace CSMWorld
|
|||
: mType (type), mBase (base)
|
||||
{}
|
||||
|
||||
template<typename RecordT>
|
||||
void BaseRefIdAdapter<RecordT>::setId (RecordBase& record, const std::string& id)
|
||||
{
|
||||
(dynamic_cast<Record<RecordT>&> (record).get().mId) = id;
|
||||
}
|
||||
|
||||
template<typename RecordT>
|
||||
std::string BaseRefIdAdapter<RecordT>::getId (const RecordBase& record) const
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue