mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-10 12:39:53 +00:00
added setId to adapter
This commit is contained in:
parent
a45339bbe6
commit
38636fab9a
@ -45,6 +45,9 @@ CSMWorld::CloneCommand::CloneCommand(CSMWorld::IdTable& model,
|
|||||||
void CSMWorld::CloneCommand::redo()
|
void CSMWorld::CloneCommand::redo()
|
||||||
{
|
{
|
||||||
mModel.cloneRecord(mIdOrigin, mIdDestination, mArgumentType, mType);
|
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()
|
void CSMWorld::CloneCommand::undo()
|
||||||
|
@ -31,6 +31,7 @@ namespace CSMWorld
|
|||||||
///< If the data type does not match an exception is thrown.
|
///< If the data type does not match an exception is thrown.
|
||||||
|
|
||||||
virtual std::string getId (const RecordBase& record) const = 0;
|
virtual std::string getId (const RecordBase& record) const = 0;
|
||||||
|
virtual void setId(RecordBase& record, const std::string& id) = 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +34,8 @@ namespace CSMWorld
|
|||||||
BaseRefIdAdapter (UniversalId::Type type, const BaseColumns& base);
|
BaseRefIdAdapter (UniversalId::Type type, const BaseColumns& base);
|
||||||
|
|
||||||
virtual std::string getId (const RecordBase& record) const;
|
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)
|
virtual QVariant getData (const RefIdColumn *column, const RefIdData& data, int index)
|
||||||
const;
|
const;
|
||||||
@ -50,6 +52,12 @@ namespace CSMWorld
|
|||||||
: mType (type), mBase (base)
|
: 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>
|
template<typename RecordT>
|
||||||
std::string BaseRefIdAdapter<RecordT>::getId (const RecordBase& record) const
|
std::string BaseRefIdAdapter<RecordT>::getId (const RecordBase& record) const
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user